3

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

I am using Qt 4.6.3 (built as static library, debug and release versions) and Boost 1.43.0 (built as static library, runtime-link also set to static, multi-threaded version, debug and release). Everything is built with MSVC++2008. Boost built 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 happens with the regex library: I have the same 4 regex libraries compiled and a quick test shows this linking error:

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

What to do?

4

3 に答える 3

7

BOOST_ALL_NO_LIB を定義できます。これにより、ブースト ライブラリの自動リンクが妨げられるため、必要なブースト ライブラリを手動でリンクする必要があります。

于 2010-08-12T05:44:48.453 に答える
3

この問題は修正されました。ブーストライブラリのコンパイル中に、link=staticオプションを選択しました。静的ライブラリを作成します。また、runtime-link = staticオプションを選択しましたが、これは間違っていました。

この問題の解決策は、runtime-link=sharedを使用してboostをコンパイルすることでした。これで、リンカがそれらを見つけられるように、正しいファイル名でいくつかのライブラリが追加されました。最初、コンパイラはdllライブラリ(libboost_python-vc90-mt-gd-1_43.libではなくboost_python-vc90-mt-gd-1_43.lib)を検索しますが、ブーストリンクから静的ライブラリへのリンクはすべて自動的に検索されます。 boost.pythonには異なる自動リンク設定が設定されているため、BOOST_PYTHON_STATIC_LIBを指定すると、最終的に適切なライブラリにリンクされ、機能します。

于 2010-08-11T19:01:01.580 に答える
3

「s」が実際に静的を表す場合 (これらの修飾子をすべて覚えているわけではありません)、コンパイル中に BOOST_ALL_DYN_LINK シンボルを定義します (コマンド ライン オプションに追加します)。DLL ライブラリにリンクするように boost に指示します。または、静的ブースト ライブラリをコンパイル/インストールします。

于 2010-08-11T17:14:17.213 に答える