Stephen Kitt <[email protected]> writes:

> On Mon, Jul 11, 2011 at 03:52:15PM +0200, Sébastien Villemot wrote:
>> $ x86_64-w64-mingw32-g++ foo.cc 
>> In file included from 
>> /usr/lib/gcc/x86_64-w64-mingw32/4.6.1/../../../../x86_64-w64-mingw32/include/winnt.h:1435:0,
>>                  from 
>> /usr/lib/gcc/x86_64-w64-mingw32/4.6.1/../../../../x86_64-w64-mingw32/include/windef.h:136,
>>                  from 
>> /usr/lib/gcc/x86_64-w64-mingw32/4.6.1/../../../../x86_64-w64-mingw32/include/windows.h:62,
>>                  from foo.cc:3:
>> /usr/lib/gcc/x86_64-w64-mingw32/4.6.1/include/emmintrin.h:234:1: error: 
>> previous declaration of ‘__m128d _mm_add_sd(__m128d, __m128d)’ with ‘C++’ 
>> linkage
>> /usr/lib/gcc/x86_64-w64-mingw32/4.6.1/../../../../x86_64-w64-mingw32/include/intrin.h:677:5:
>>  error: conflicts with new declaration with ‘C’ linkage
>> /usr/lib/gcc/x86_64-w64-mingw32/4.6.1/include/emmintrin.h:228:1: error: 
>> previous declaration of ‘__m128d _mm_add_pd(__m128d, __m128d)’ with ‘C++’ 
>> linkage
>> /usr/lib/gcc/x86_64-w64-mingw32/4.6.1/../../../../x86_64-w64-mingw32/include/intrin.h:678:5:
>>  error: conflicts with new declaration with ‘C’ linkage
>> /usr/lib/gcc/x86_64-w64-mingw32/4.6.1/include/emmintrin.h:270:1: error: 
>> previous declaration of ‘__m128d _mm_div_sd(__m128d, __m128d)’ with ‘C++’ 
>> linkage
>> /usr/lib/gcc/x86_64-w64-mingw32/4.6.1/../../../../x86_64-w64-mingw32/include/intrin.h:679:5:
>>  error: conflicts with new declaration with ‘C’ linkage
>
> Apparently this is already known upstream; see
> <https://sourceforge.net/tracker/index.php?func=detail&aid=2962480&group_id=2435&atid=102435>.
> Kai Tietz sent a patch for gcc
> (<http://gcc.gnu.org/ml/gcc-patches/2010-03/msg00033.html>) but it
> hasn't been applied yet.

Thanks for pointing me to this.

>> Note that in my original program I was trying to include both:
>> 
>> #include <boost/math/special_functions/lanczos.hpp>
>> #include <windows.h>
>> 
>> Then I tracked the problem down to emmintrin.h, which is included by the 
>> Boost
>> header when SSE2 is present.
>
> Perhaps the workaround given in the sourceforge.net bug report would
> work:
>
> #include <windows.h>
> #include <boost/math/special_functions/lanczos.hpp>

Actually my setup is a bit more complicated than that, I have several
nested inclusion levels with many headers, so this workaround may not be
easy to apply in my case, but I will try.

Of course, from my point of view, the best solution would be to
incorporate the aforementionned patch in the next package upload.

Many thanks,

-- 
Sébastien Villemot
CEPREMAP - Paris School of Economics
Homepage: http://www.dynare.org/sebastien
Landline phone: +33 1 40 77 49 90
SIP phone: [email protected]
PGP Key: 2069 1DFC C2C9 8C47 9529  84EE 0001 8C22 381A 7594

Attachment: pgpvGGBspgD78.pgp
Description: PGP signature

Reply via email to