[Insight-users] Problems with std::basic_stringbuf and vnl

Sergio Andres sergio at unizar.es
Mon, 19 Apr 2004 11:58:38 +0200


Hi Luis,


I compiled ITK for Release.
Then I compiled my application for Release.

But I got some errors, which are related to vnl_matlab_filewrite class.

These are the error messages:

Linking...
itkvnl.lib(vnl_matlab_filewrite.obj) : error LNK2005: "public: virtual
__thiscall std::basic_stringbuf<char,struct std::char_traits<char>,class
std::allocator<char> >::~basic_stringbuf<char,struct
std::char_traits<char>,class std::allocator<char> >(
void)"
(??1?$basic_stringbuf at DU?$char_traits at D at std at  at V?$allocator at D at 2 at  at std at  at UAE at XZ)
already defined in msvcprt.lib(MSVCP60.dll)
itkvnl.lib(vnl_matlab_filewrite.obj) : error LNK2005: "protected: void
__thiscall std::basic_stringbuf<char,struct std::char_traits<char>,class
std::allocator<char> >::_Tidy(void)"
(?_Tidy at ?$basic_stringbuf at DU?$char_traits at D at std at  at V?$allocator at D at 2 at  at s
td at  at IAEXXZ) already defined in msvcprt.lib(MSVCP60.dll)
itkvnl.lib(vnl_matlab_filewrite.obj) : error LNK2005: "protected: void
__thiscall std::basic_stringbuf<char,struct std::char_traits<char>,class
std::allocator<char> >::_Init(char const *,unsigned int,int)"
(?_Init at ?$basic_stringbuf at DU?$char_traits at D
 at std at  at V?$allocator at D at 2 at  at std at  at IAEXPBDIH at Z) already defined in
msvcprt.lib(MSVCP60.dll)
itkvnl.lib(vnl_matlab_filewrite.obj) : warning LNK4006: "public: virtual
__thiscall std::basic_stringbuf<char,struct std::char_traits<char>,class
std::allocator<char> >::~basic_stringbuf<char,struct
std::char_traits<char>,class std::allocator<char>
  >(void)"
(??1?$basic_stringbuf at DU?$char_traits at D at std at  at V?$allocator at D at 2 at  at std at  at UAE at XZ)
already defined in msvcprt.lib(MSVCP60.dll); second definition ignored
itkvnl.lib(vnl_matlab_filewrite.obj) : warning LNK4006: "protected: void
__thiscall std::basic_stringbuf<char,struct std::char_traits<char>,class
std::allocator<char> >::_Tidy(void)"
(?_Tidy at ?$basic_stringbuf at DU?$char_traits at D at std at  at V?$allocator at D at 2 at 
 at std at  at IAEXXZ) already defined in msvcprt.lib(MSVCP60.dll); second
definition ignored
itkvnl.lib(vnl_matlab_filewrite.obj) : warning LNK4006: "protected: void
__thiscall std::basic_stringbuf<char,struct std::char_traits<char>,class
std::allocator<char> >::_Init(char const *,unsigned int,int)"
(?_Init at ?$basic_stringbuf at DU?$char_traits
 at D at std at  at V?$allocator at D at 2 at  at std at  at IAEXPBDIH at Z) already defined in
msvcprt.lib(MSVCP60.dll); second definition ignored
    Creating library Release/ASM_Battery.lib and object
Release/ASM_Battery.exp
Release/ASM_Battery.exe : fatal error LNK1169: one or more multiply
defined symbols found
Error executing link.exe.


If I compile without using the vnl_matlab_filewrite class, I get no error.
So I think this has to do with standard streams or string includes ...

Any help will be appreciated.

Regards,
Sergio.



Luis Ibanez escribió:

 >
 > Hi Sergion,
 >
 > This usually happens when you mix code compiled
 > for Release with code compiled for Debug.
 >
 > You are probably compiling ITK for one mode and
 > your application for the other compilation mode.
 >
 > This shouldn't be a problem if your application
 > has a CMakeList.txt file correctly configured...
 >
 > You are probably forcing the names of the libraries
 > to link with,... or maybe you are not using CMake
 > for configuring your project... ?
 >
 > --------
 >
 > If you get errors when you compile ITK for Debug,
 > please post the exact error messages to the list.
 >
 >
 > Error messages are usually very helpful   :-)
 >
 >
 >
 >   Thanks
 >
 >
 >      Luis
 >
 >
 >
 > ----------------------
 > Sergio Andres wrote:
 >
 >>
 >> Hi all,
 >>
 >> I have compiled ITK with MSVC++ 6.0 (Release configuration) and my
 >> application,
 >> which uses vnl_matlab_filewrite... and I got 4 errors like this:
 >>
 >> msvcprt.lib(MSVCP60.dll) : error LNK2005:
 >> public: virtual __thiscall std::basic_stringbuf<char,struct
 >> std::char_traits<char>,class std::allocator<char>
 >>  >::~basic_stringbuf<char,struct std::char_traits<char>,class
 >> std::allocator<char> >(void)"
 >> 
(??1?$basic_stringbuf at DU?$char_traits at D at std at  at V?$allocator at D at 2 at  at std at  at UAE at XZ)
 >> already defined in itkvnl.lib(vnl_matlab_filewrite.obj)
 >>
 >> I don't know what to do to fix it..
 >>
 >> Furthermore, I got no errors when I compiled in Debug configuration.
 >>
 >> I will appreciate any help.
 >> Thanks!
 >>
 >> Regards,
 >> Sergio Andres.
 >>
 >> _______________________________________________
 >> Insight-users mailing list
 >> Insight-users at itk.org
 >> http://www.itk.org/mailman/listinfo/insight-users
 >>
 >
 >
 >
 > _______________________________________________
 > Insight-users mailing list
 > Insight-users at itk.org
 > http://www.itk.org/mailman/listinfo/insight-users
 >