Philipp
Philipp

Reputation: 93

VC++ 2010 wants to link boost libararies i didn't even specify

I'm trying to build my application with MSVC 2010 instead of GCC. With GCC everything works fine. My app uses boost_system and boost_thread libraries. I built boost with VC2010 in "system" layout, that means the libraries are named just libboost_system.lib (and not libboost_system_compiler_threading_version_wtf_snafu.lib) The libs reside in C:\Boost\lib, the Makefile specifies

LFLAGS        = /NOLOGO /INCREMENTAL:NO /SUBSYSTEM:CONSOLE
LIBS          = /LIBPATH:C:/Boost/lib libboost_system.lib libboost_thread.lib Ws2_32.lib

when invoking nmake it compiles, but when trying to link it quits with

LINK : fatal error LNK1104: cannot open file 'libboost_date_time-vc100-mt-1_43.lib

I mean seriously, WTF? I told it to link libboost_systen.lib and libboost_thread.lib how come it tries to link libboost_data_time and why does it assume I built the libs in "tagged" layout?? How can I stop MSVC trying to be smart and guess what I might have wanted to link?

Thanks, Philipp

Upvotes: 5

Views: 1612

Answers (2)

CppNoob
CppNoob

Reputation: 2390

Assuming you are auto-linking (i.e. you've defined BOOST_ALL_DYN_LINK or library specific equivalents).

For layout 'system' you have to define the preprocessor macro:

BOOST_AUTO_LINK_NOMANGLE

to link to the correct library names.

For layout 'tagged' you have to define the preprocessor macro:

BOOST_AUTO_LINK_TAGGED

to link to the correct library names.

I don't know if you could do this override for some libraries and keep the default for others. That would be a very cumbersome setup I'd imagine.

Upvotes: 1

Joe
Joe

Reputation: 42627

This is a feature of the Boost libs with compatible compilers for automatic linking.

(Those convoluted library names cover the myriad of threading and linking options that are available on the platform; there are good reasons to use that convention on Windows...)

More information here:

http://www.boost.org/doc/libs/1_33_1/more/getting_started.html#auto-link

I can't find a page for a more recent version, but I believe the BOOST_ALL_NO_LIB and related options are all still valid in 1.43.

Upvotes: 5

Related Questions