[Insight-developers] compile error on VC++
Luis Ibanez
luis.ibanez@kitware.com
Tue, 14 May 2002 16:36:34 -0400
Hi Lydia,
Yeap, we have seen this error before.
It is fact lake a bad dream, :-/
This is one of this VC++ "features"
that makes you what to install Linux.
The error seems to be originated by
the fact that VC++ decides between
the old iostream standard and the new
std::iostream by using some 'artificial
intelligence' clues (read: arbitrary rules).
These rules lead the compiler to different
conclusions in different cxx. So by the
time you get to link time, some of the .o's
have old iostream classes and others have
new iostream classes.
The way in which this has been resolved
in the past is by exchanging the order
of #include headers in the code involved.
The suspects are <iostream>, <fstream>
and any of the itk headers (in particular
itkWin32.h).
The scientific approach we have used in
the past is: to try all the combinations
until the compiler stop complaining. :-)
Luis
======================================
Lydia Ng wrote:
> Dear All,
>
> The VC++ build seems to be broken.
> Looks like is a duplicate symbols problem - I even tried
> a clean rebuild.
> Are others getting the same thing, better still does
> anyone know the fix?
>
> -Lydia
>
> --------------------Configuration: itkBasicFiltersTests - Win32
> Release--------------------
> Linking...
> msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: virtual __thiscall
> std::basic_filebuf<char,struct std::char_traits<char>
>
>>::~basic_filebuf<char,struct std::char_traits<char> >(void)"
>>
> (??1?$basic_filebuf@DU?$char_traits@D@std@@@std@@UAE@XZ) alread
> y defined in itkCannyEdgeDetectionImageFilterTest.obj
> msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: class
> std::basic_filebuf<char,struct std::char_traits<char> > * __thiscall
> std::basic_filebuf<char,struct std::char_traits<char> >::open(char const
> *,int)" (?open@?$basic_filebuf@DU?$char_traits@D@s
> td@@@std@@QAEPAV12@PBDH@Z) already defined in
> itkCannyEdgeDetectionImageFilterTest.obj
> msvcprt.lib(MSVCP60.dll) : error LNK2005: "protected: void __thiscall
> std::basic_filebuf<char,struct std::char_traits<char> >::_Init(struct
> _iobuf *,enum std::basic_filebuf<char,struct std::char_traits<char>
>
>>::_Initfl)" (?_Init@?$basic_filebuf@DU?$
>>
> char_traits@D@std@@@std@@IAEXPAU_iobuf@@W4_Initfl@12@@Z) already defined
> in itkCannyEdgeDetectionImageFilterTest.obj
> msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: __thiscall
> std::basic_filebuf<char,struct std::char_traits<char>
>
>>::basic_filebuf<char,struct std::char_traits<char> >(struct _iobuf *)"
>>
> (??0?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAE@PAU_iobu
> f@@@Z) already defined in itkCannyEdgeDetectionImageFilterTest.obj
> msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: virtual __thiscall
> std::basic_ofstream<char,struct std::char_traits<char>
>
>>::~basic_ofstream<char,struct std::char_traits<char> >(void)"
>>
> (??1?$basic_ofstream@DU?$char_traits@D@std@@@std@@UAE@XZ) alr
> eady defined in itkCannyEdgeDetectionImageFilterTest.obj
> msvcprt.lib(MSVCP60.dll) : warning LNK4006: "public: virtual __thiscall
> std::basic_filebuf<char,struct std::char_traits<char>
>
>>::~basic_filebuf<char,struct std::char_traits<char> >(void)"
>>
> (??1?$basic_filebuf@DU?$char_traits@D@std@@@std@@UAE@XZ) alre
> ady defined in itkCannyEdgeDetectionImageFilterTest.obj; second
> definition ignored
> msvcprt.lib(MSVCP60.dll) : warning LNK4006: "public: class
> std::basic_filebuf<char,struct std::char_traits<char> > * __thiscall
> std::basic_filebuf<char,struct std::char_traits<char> >::open(char const
> *,int)" (?open@?$basic_filebuf@DU?$char_traits@D
> @std@@@std@@QAEPAV12@PBDH@Z) already defined in
> itkCannyEdgeDetectionImageFilterTest.obj; second definition ignored
> msvcprt.lib(MSVCP60.dll) : warning LNK4006: "protected: void __thiscall
> std::basic_filebuf<char,struct std::char_traits<char> >::_Init(struct
> _iobuf *,enum std::basic_filebuf<char,struct std::char_traits<char>
>
>>::_Initfl)" (?_Init@?$basic_filebuf@DU
>>
> ?$char_traits@D@std@@@std@@IAEXPAU_iobuf@@W4_Initfl@12@@Z) already
> defined in itkCannyEdgeDetectionImageFilterTest.obj; second definition
> ignored
> msvcprt.lib(MSVCP60.dll) : warning LNK4006: "public: __thiscall
> std::basic_filebuf<char,struct std::char_traits<char>
>
>>::basic_filebuf<char,struct std::char_traits<char> >(struct _iobuf *)"
>>
> (??0?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAE@PAU_io
> buf@@@Z) already defined in itkCannyEdgeDetectionImageFilterTest.obj;
> second definition ignored
> msvcprt.lib(MSVCP60.dll) : warning LNK4006: "public: virtual __thiscall
> std::basic_ofstream<char,struct std::char_traits<char>
>
>>::~basic_ofstream<char,struct std::char_traits<char> >(void)"
>>
> (??1?$basic_ofstream@DU?$char_traits@D@std@@@std@@UAE@XZ) a
> lready defined in itkCannyEdgeDetectionImageFilterTest.obj; second
> definition ignored
> Creating library Release/itkBasicFiltersTests.lib and object
> Release/itkBasicFiltersTests.exp
> Release/itkBasicFiltersTests.exe : fatal error LNK1169: one or more
> multiply defined symbols found
> Error executing link.exe.
>
> itkBasicFiltersTests.exe - 6 error(s), 5 warning(s)
> _______________________________________________
> Insight-developers mailing list
> Insight-developers@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-developers
>
>