Boost autolizes libraries that are not created by Boost, but intended

I am developing a Math application that can be extended by writing python scripts.

I use Qt 4.6.3 (built as a static library, debugs and releases versions) and Boost 1.43.0 (built-in as a static library, runtime-link is also installed in a static, multi-threaded version, debugs and releases). Everything was built using MSVC ++ 2008. Boost built the following libraries:

  • libboost_python-vc90-t-s-1_43.lib
  • libboost_python-vc90-mt-s.lib
  • libboost_python-vc90-mt-sing-1_43.lib
  • libboost_python-vc90-mt-sgd.lib

My project compiles, but gives the following error during the binding phase:

1>Linking... 1>LINK : fatal error LNK1104: cannot open file 'boost_python-vc90-mt-gd-1_43.lib' 

Why doesn't he select one of my compiled libraries?

I think s in the library names is static, but then the auto-link function seems to select a dynamic library, and I want all of this to be linked statically in one executable.

The same thing happens with the regex library: I have the same 4 regular expression libraries that were compiled, and a quick test shows this binding error:

 1>LINK : fatal error LNK1104: cannot open file 'libboost_regex-vc90-mt-gd-1_43.lib' 

What to do?

+3
source share
3 answers

The problem is fixed, during compilation of boost libraries I selected the link = static parameter. What creates static libraries. I also chose runtime-link = static, and that was wrong!

The solution to this problem was to compile using runtime-link = shared. Additional libraries are now added with the correct file names, so the linker can find them. At first, the compiler is still looking for the dll library (boost_python-vc90-mt-gd-1_43.lib, not libboost_python-vc90-mt-gd-1_43.lib), everything else from boost links is automatically to the static library, but because boost.python there is another automatic binding, when you provide BOOST_PYTHON_STATIC_LIB, it finally connects to the right library and works!

+3
source

You can define BOOST_ALL_NO_LIB. This prevents boost libraries from linking automatically, and you must manually link the required boost files.

+7
source

If 's' really stands for static (I don’t know all these modifiers by heart), define a BOOST_ALL_DYN_LINK character at compile time (add it to the command line options). It tells boost to reference DLLs. Alternatively, compile / install static acceleration libraries.

+3
source

All Articles