Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 835
Philipp Avatar asked Jun 02 '10 19:06

Philipp


1 Answers

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.

like image 199
Joe Avatar answered Nov 15 '22 11:11

Joe