Link problem with boost::signals and console applications in MS Visual C++ 6 / Windows
Hi all,
a colleague asked me to post the following question:
When using the boost signal lib in VC6 (Win32 Console Application), the
linker produces the following errors:
msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: __thiscall
std::_Lockit::~_Lockit(void)" (??1_Lockit@std@@QAE@XZ) already defined in
libcpd.lib(iostream.obj)
msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: __thiscall
std::_Lockit::_Lockit(void)" (??0_Lockit@std@@QAE@XZ) already defined in
libcpd.lib(iostream.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: "public: __thiscall
exception::exception(class exception const &)" (??0exception@@QAE@ABV0@@Z)
already defined in LIBCD.lib(stdexcpt.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: "public: __thiscall
exception::exception(void)" (??0exception@@QAE@XZ) already defined in
LIBCD.lib(stdexcpt.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: "public: virtual __thiscall
exception::~exception(void)" (??1exception@@UAE@XZ) already defined in
LIBCD.lib(stdexcpt.obj)
LINK : warning LNK4098: defaultlib "MSVCRT" conflicts with use of other
libs; use /NODEFAULTLIB:library
Debug/boost.exe : fatal error LNK1169: one or more multiply defined symbols
found
There seems to be a conflict between the libraries signals.lib, libcpd.lib
and libcd.lib.
When I try to ignore the libraries libcpd.lib and libcd.lib in the project
settings, other linker errors occur when I use std::cout for example:
main.obj : error LNK2001: unresolved external symbol "class
std::basic_ostream
On Tuesday 26 November 2002 05:48 am, Klaus Nowikow wrote:
a colleague asked me to post the following question:
When using the boost signal lib in VC6 (Win32 Console Application), the linker produces the following errors:
msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: __thiscall std::_Lockit::~_Lockit(void)" (??1_Lockit@std@@QAE@XZ) already defined in libcpd.lib(iostream.obj) msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: __thiscall std::_Lockit::_Lockit(void)" (??0_Lockit@std@@QAE@XZ) already defined in libcpd.lib(iostream.obj) MSVCRT.lib(MSVCRT.dll) : error LNK2005: "public: __thiscall exception::exception(class exception const &)" (??0exception@@QAE@ABV0@@Z) already defined in LIBCD.lib(stdexcpt.obj) MSVCRT.lib(MSVCRT.dll) : error LNK2005: "public: __thiscall exception::exception(void)" (??0exception@@QAE@XZ) already defined in LIBCD.lib(stdexcpt.obj) MSVCRT.lib(MSVCRT.dll) : error LNK2005: "public: virtual __thiscall exception::~exception(void)" (??1exception@@UAE@XZ) already defined in LIBCD.lib(stdexcpt.obj) LINK : warning LNK4098: defaultlib "MSVCRT" conflicts with use of other libs; use /NODEFAULTLIB:library Debug/boost.exe : fatal error LNK1169: one or more multiply defined symbols found
There seems to be a conflict between the libraries signals.lib, libcpd.lib and libcd.lib. When I try to ignore the libraries libcpd.lib and libcd.lib in the project settings, other linker errors occur when I use std::cout for example: main.obj : error LNK2001: unresolved external symbol "class std::basic_ostream
std::cout" (?cout@std@@3V?$basic_ostream@DU?$char_traits@D@std@@@1@A) Is there a way to use the boost::signals library in a Win32 Console Application in VC6?
Yes. I believe the problem is that Signals is built against the dynamic run-time libraries whereas VC6 console applications default to static linking. Within the project options there is a setting for the type of run-time to link against. I suggest changing that (to single-threaded dynamic). I hope someone more familiar with VC6 will correct me if I am wrong... Doug
Is there a way to use the boost::signals library in a Win32 Console Application in VC6?
Yes. I believe the problem is that Signals is built against the dynamic run-time libraries whereas VC6 console applications default to static linking. Within the project options there is a setting for the type of run-time to link against. I suggest changing that (to single-threaded dynamic).
I hope someone more familiar with VC6 will correct me if I am wrong...
It worked, thanks Doug. For others interested: In the project settings, section "C/C++ / Code Generation", "Use run-time library", he used "Multithreaded DLL" (there is no option "Singlethreaded DLL"). -- Klaus
Klaus Nowikow wrote: <snip error messages>
There seems to be a conflict between the libraries signals.lib, libcpd.lib and libcd.lib. When I try to ignore the libraries libcpd.lib and libcd.lib in the project settings, other linker errors occur when I use std::cout for example: main.obj : error LNK2001: unresolved external symbol "class std::basic_ostream
std::cout" (?cout@std@@3V?$basic_ostream@DU?$char_traits@D@std@@@1@A) Is there a way to use the boost::signals library in a Win32 Console Application in VC6?
Have a look at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/... This page shoud help you to sort out the library conflicts. HTH, Markus
participants (3)
-
Douglas Gregor
-
Klaus Nowikow
-
Markus Schöpflin