Boost logo

Boost Users :

From: bill_kempf (williamkempf_at_[hidden])
Date: 2002-03-19 17:45:31


--- In Boost-Users_at_y..., "gunnarnl" <gunnar_at_m...> wrote:
> I've created a windows console project with VC++ 6.0 and just used
> one of the examples in the documentation. I've also added the
> BOOST_HAS_THREADS macro in the settings. The program compiles well
in
> debug mode but gives the following linking errors:

You shouldn't add BOOST_HAS_THREADS. This will be set for you by the
config headers if you've linked against the multi-threaded runtime
libraries.

> Compiling...
> main.cpp
> Linking...
> msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "public: virtual
> __thiscall std::runtime_error::~runtime_error(void)" (??
> 1runtime_error_at_std@@UAE_at_XZ) already defined in main.obj
> msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "public: __thiscall
> std::runtime_error::runtime_error(class
runtime_error::runtime_error
> const &)" (??0runtime_error_at_std@@QAE_at_ABV01@@Z) already defined in
> main.obj
> msvcprtd.lib(MSVCP60D.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_strin
> g_at_DU?$char_traits_at_D@std@@V?$allocator_at_D@2@@std@@QAE_at_XZ) already
> defined in main.obj
> msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "public: __thiscall
> std::runtime_error::runtime_error(class
> runtime_error::basic_string<char,struct
std::char_traits<char>,class
> std::allocator<char> > const &)" (??0runtime_error_at_std@@QAE_at_ABV?
> $basic_strin
> g_at_DU?$char_traits_at_D@std@@V?$allocator_at_D@2@@1@@Z) already defined in
> libcpmtd.lib(ios.obj)
> msvcprtd.lib(MSVCP60D.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> >(char const
> *,class basic_
> string<char,struct std::char_traits<char>,class
std::allocator<char>
> >::allocator<char> const &)" (??0?$basic_string_at_DU?
> $char_traits_at_D@std@@V?$allocator_at_D@2@@std@@QAE_at_PBDABV?
> $allocator_at_D@1@@Z) already defined in main.obj
> LINK : warning LNK4098: defaultlib "MSVCRTD" conflicts with use of
> other libs; use /NODEFAULTLIB:library
> Debug/threads.exe : fatal error LNK1169: one or more multiply
defined
> symbols found
> Error executing link.exe.

Link errors like this are an indication that both the DLL and the LIB
version of the C RTL have been linked into your application. If you
are using the last release of Boost Jam built only libraries that
link against the DLL version of the C RTL and you should do the same
in your application (Project | Settings | C/C++ | Code Generation |
Use run-time library | (Debug) Multithreaded DLL). The current CVS
Jamfiles will build libraries that link against both the DLL and the
LIB version of the C RTL so you'll be able to choose which to link
against with your own applications, but you'll need to insure you
link against the correct libboost_thread.lib in that case.

> Any help on this would be appreciated.

Hope that helped.

Bill Kempf


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net