Ufx Ufx - 2 months ago 20
C++ Question

Linker requires versions of compiler and Boost in the names of lib-files. fatal error LNK1104

To install boost I run

b2 install optimization=speed variant=debug,release --layout=tagged --prefix=BOOST_DIR


Names of lib-files look like

...
libboost_serialization-mt.lib
libboost_serialization-mt-gd.lib
...


When project is linking I get error


LINK : fatal error LNK1104: cannot open file 'libboost_serialization-vc140-mt-gd-1_62.lib'


This file is not set in project settings with any names, only directory of this file is set. The project is linking if I add compiler and Boost versions to the file name.

Can I make the project no need of Boost lib-files renaming when I install new version of Boost?

Answer

When building boost with the --layout=tagged option, you have to define BOOST_AUTO_LINK_TAGGED before including any boost header to allow auto-linking to work correctly. Otherwise, disable auto-linking by defining BOOST_ALL_NO_LIB and explicitly specify the library.

Comments