[boost-users] [boost-thread linker error on msvc]

Hi i get the following linker error when compling a program that links to boost-thread. Here is the error... "C:/Program Files/Microsoft Visual Studio 8/VC/bin/lib.exe" -LTCG -out:"./lib/libAlgorithm.lib" ./lib/BitOperation.obj ./lib/ContainerOperation.obj ./lib/DiffieHellman.obj ./lib/dsa.obj ./lib/Elucid.obj ./lib/IsPrime.obj ./lib/mathfunc.obj ./lib/median.obj ./lib/NpComplete.obj ./lib/polynomial.obj ./lib/rsa.obj ./lib/sortingAlgo.obj ./lib/Fourier.obj ./lib/AES.obj Microsoft (R) Library Manager Version 8.00.50727.762 Copyright (C) Microsoft Corporation. All rights reserved. rsa.obj : warning LNK4006: "class boost::random::shuffle_output<class boost::random::linear_congruential<unsigned long,1366,150889,714025,0>,97,139726> Random::generator" (?generator@Random@@3V?$shuffle_output@V ?$linear_congruential@K$0FFG@$0CENGJ@$0KOFCJ@$0A@@random@boost @@$0GB@$0CCBMO@@random@boost@@A) already defined in sortingAlgo.obj; second definition ignored rsa.obj : warning LNK4006: "void __cdecl Random::initialize(void)" (?initialize@Random@@YAXXZ) already defined in sortingAlgo.obj; second definition ignored NpComplete.obj : warning LNK4006: "class boost::random::shuffle_output<class boost::random::linear_congruential<unsigned long,1366,150889,714025,0>,97,139726> Random::generator" (?generator@Random@@3V?$shuffle_output@V ?$linear_congruential@K$0FFG@$0CENGJ@$0KOFCJ@$0A@@random@boost @@$0GB@$0CCBMO@@random@boost@@A) already defined in sortingAlgo.obj; second definition ignored NpComplete.obj : warning LNK4006: "void __cdecl Random::initialize(void)" (?initialize@Random@@YAXXZ) already defined in sortingAlgo.obj; second definition ignored IsPrime.obj : warning LNK4006: "class boost::random::shuffle_output<class boost::random::linear_congruential<unsigned long,1366,150889,714025,0>,97,139726> Random::generator" (?generator@Random@@3V?$shuffle_output@V ?$linear_congruential@K$0FFG@$0CENGJ@$0KOFCJ@$0A@@random@boost @@$0GB@$0CCBMO@@random@boost@@A) already defined in sortingAlgo.obj; second definition ignored IsPrime.obj : warning LNK4006: "void __cdecl Random::initialize(void)" (?initialize@Random@@YAXXZ) already defined in sortingAlgo.obj; second definition ignored dsa.obj : warning LNK4006: "class boost::random::shuffle_output<class boost::random::linear_congruential<unsigned long,1366,150889,714025,0>,97,139726> Random::generator" (?generator@Random@@3V?$shuffle_output@V ?$linear_congruential@K$0FFG@$0CENGJ@$0KOFCJ@$0A@@random@boost @@$0GB@$0CCBMO@@random@boost@@A) already defined in sortingAlgo.obj; second definition ignored dsa.obj : warning LNK4006: "void __cdecl Random::initialize(void)" (?initialize@Random@@YAXXZ) already defined in sortingAlgo.obj; second definition ignored DiffieHellman.obj : warning LNK4006: "class boost::random::shuffle_output<class boost::random::linear_congruential<unsigned long,1366,150889,714025,0>,97,139726> Random::generator" (?generator@Random@@3V?$shuffle_output@V ?$linear_congruential@K$0FFG@$0CENGJ@$0KOFCJ@$0A@@random@boost @@$0GB@$0CCBMO@@random@boost@@A) already defined in sortingAlgo.obj; second definition ignored DiffieHellman.obj : warning LNK4006: "void __cdecl Random::initialize(void)" (?initialize@Random@@YAXXZ) already defined in sortingAlgo.obj; second definition ignored rm -f ./lib/BitOperation.obj ./lib/ContainerOperation.obj ./lib/DiffieHellman.obj ./lib/dsa.obj ./lib/Elucid.obj ./lib/IsPrime.obj ./lib/mathfunc.obj ./lib/median.obj ./lib/NpComplete.obj ./lib/polynomial.obj ./lib/rsa.obj ./lib/sortingAlgo.obj ./lib/Fourier.obj ./lib/AES.obj "C:/Program Files/Microsoft Visual Studio 8/VC/bin/link.exe" -LTCG -out: PolyTestProject.exe ./project/PolyTest.obj -LIBPATH:"C:/Program Files/Microsoft Visual Studio 8/VC/lib" -LIBPATH:"C:/boost_msvc/lib" -LIBPATH:"./lib" libAlgorithm.lib libboost_thread-mt.lib -MACHINE:x86 -nologo -NODEFAULTLIB:msvcrt msvcprt.lib(MSVCP80.dll) : error LNK2005: "public: void __thiscall std::_Mutex::_Lock(void)" (?_Lock@_Mutex@std@@QAEXXZ) already defined in libcpmt.lib(xmutex.obj) msvcprt.lib(MSVCP80.dll) : error LNK2005: "public: void __thiscall std::_Mutex::_Unlock(void)" (?_Unlock@_Mutex@std@@QAEXXZ) already defined in libcpmt.lib(xmutex.obj) msvcprt.lib(MSVCP80.dll) : error LNK2005: "public: class std::basic_ostream<char,struct std::char_traits<char> > & __thiscall std::basic_ostream<char,struct std::char_traits<char> >::flush(void)" (?flush@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV12@XZ) already defined in PolyTest.obj msvcprt.lib(MSVCP80.dll) : error LNK2005: "public: void __thiscall std::basic_ostream<char,struct std::char_traits<char> >::_Osfx(void)" (?_Osfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEXXZ) already defined in PolyTest.obj msvcprt.lib(MSVCP80.dll) : error LNK2005: "bool __cdecl std::uncaught_exception(void)" (?uncaught_exception@std@@YA_NXZ) already defined in libcpmt.lib(uncaught.obj) msvcprt.lib(MSVCP80.dll) : error LNK2005: "public: void __thiscall std::basic_ios<char,struct std::char_traits<char> >::setstate(int,bool)" (?setstate@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEXH_N@Z) already defined in PolyTest.obj msvcprt.lib(MSVCP80.dll) : error LNK2005: "public: int __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::sputn(char const *,int)" (?sputn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHPBDH@Z) already defined in PolyTest.obj msvcprt.lib(MSVCP80.dll) : error LNK2005: "public: int __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::sputc(char)" (?sputc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHD@Z) already defined in PolyTest.obj msvcprt.lib(MSVCP80.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)" (??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) already defined in PolyTest.obj PolyTest.obj : error LNK2001: unresolved external symbol "class ?? ::InputIterator __cdecl algocpw::horner( ?? ) throw( ?? )" (?horner@algocpw@@YA?AVInputIterator) PolyTest.obj : error LNK2001: unresolved external symbol "class ?? ::InputIterator __cdecl algocpw::evaluate( ?? ) throw( ?? )" (?evaluate@algocpw@@YA?AVInputIterator) PolyTestProject.exe : fatal error LNK1120: 2 unresolved externals I am suing msvc 2005.

chun ping wang wrote:
Hi i get the following linker error when compling a program that links to boost-thread.
You're seeing multiple runtime libraries being linked against. It implies that one or more of your object files and/or libraries was built with different code generation options than your application. Why not let the auto-link code find the correct VC library build for you rather than link against your own build of libboost_thread ? HTH, John.

oh cause when i build boost for msvc i did it with layout=system so autolink can't find it unless theirs an update or fix to it. On Jan 22, 2008 1:27 AM, John Maddock <john@johnmaddock.co.uk> wrote:
chun ping wang wrote:
Hi i get the following linker error when compling a program that links to boost-thread.
You're seeing multiple runtime libraries being linked against. It implies that one or more of your object files and/or libraries was built with different code generation options than your application.
Why not let the auto-link code find the correct VC library build for you rather than link against your own build of libboost_thread ?
HTH, John.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

chun ping wang wrote:
oh cause when i build boost for msvc i did it with layout=system so autolink can't find it unless theirs an update or fix to it.
None the less the issue is the same: the library you are linking against is not binary compatible with your application build settings. HTH, John.
participants (2)
-
chun ping wang
-
John Maddock