views:

73

answers:

3

Hello, I am developing a Math application which can be extended by writing python scripts.

I am using QT 4.6.3 (build as static library, debug and release versions) and Boost 1.43.0 (build as static library, runtime-link also set to static, multi-threaded version, debug and release). Everything is build with MSVC++2008. The boost build the following libraries:

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

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

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

Why is it not selecting one of my compiled libraries?

I think the s in the library names stands for static, but then the auto-linking feature seems to select a dynamic library, and I want it all linked statically in one executable.

the same goes true for the regex library, I have the same 4 regex libraries compiled, a quick test also shows this linking error:

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

What to do?, thanks in advance!

A: 

If 's' stands indeed for static (I don't know all those modifiers by heart), define the BOOST_ALL_DYN_LINK symbol while compiling (add it to the command line options). It tells boost to link to the DLL libraries. Alternatively, compile/install static boost libraries.

but I compiled and installed the boost static libraries, and I want to link to them! I don't want to distribute DLL's with my application.
toefel
+1  A: 

The problem is fixed, during the compilation of the boost libraries, I selected the link=static option. Which creates static libraries. I also selected runtime-link=static option, and this was wrong!

The solution for this problem was compiling boost with runtime-link=shared. Now some extra libraries are added, with the correct filenames, so the linker can find them. At first is still searched for the dll library (boost_python-vc90-mt-gd-1_43.lib, instead of libboost_python-vc90-mt-gd-1_43.lib), everything else from boost links automatically toe static library, but because boost.python has a different auto-linkage set up, when you provide BOOST_PYTHON_STATIC_LIB, it finally links to the right library and it works!

toefel
+1  A: 

You can define BOOST_ALL_NO_LIB. This prevents automatic linking of boost libraries and you must then link the required boost libs manually.

Ralf