为什么在没有任何导出功能的情况下增强python构建

时间:2014-05-20 16:59:03

标签: python c++ boost compilation dllexport

我构建了boost python(1.55),没有任何错误或警告。 这是清单:

C:\Programming\boost>b2 toolset=msvc-11.0 link=static variant=release threading=multi runtime-link=static --with-python
link.jam: No such file or directory
Building the Boost C++ Libraries.

Component configuration:
    - atomic                   : not building
    - chrono                   : not building
    - context                  : not building
    - coroutine                : not building
    - date_time                : not building
    - exception                : not building
    - filesystem               : not building
    - graph                    : not building
    - graph_parallel           : not building
    - iostreams                : not building
    - locale                   : not building
    - log                      : not building
    - math                     : not building
    - mpi                      : not building
    - program_options          : not building
    - python                   : building
    - random                   : not building
    - regex                    : not building
    - serialization            : not building
    - signals                  : not building
    - system                   : not building
    - test                     : not building
    - thread                   : not building
    - timer                    : not building
    - wave                     : not building

...patience...
...patience...
...found 1654 targets...
...updating 30 targets...
compile-c-c++ bin.v2\libs\python\build\msvc-11.0\release\link-static\runtime-link-static\threading-multi\numeric.obj
numeric.cpp
..........................
compile-c-c++ bin.v2\libs\python\build\msvc-11.0\release\link-static\runtime-link-static\threading-multi\object\function_doc_signature.obj
function_doc_signature.cpp
msvc.archive bin.v2\libs\python\build\msvc-11.0\release\link-static\runtime-link-static\threading-multi\libboost_python-vc110-mt-s-1_55.lib
common.copy stage\lib\libboost_python-vc110-mt-s-1_55.lib
bin.v2\libs\python\build\msvc-11.0\release\link-static\runtime-link-static\threading-multi\libboost_python-vc110-mt-s-1_55.lib
Скопировано файлов:         1.
...updated 30 targets...

The Boost C++ Libraries were successfully built!
The following directory should be added to compiler include paths:
    C:/Programming/boost
The following directory should be added to linker library paths:
    C:\Programming\boost\stage\lib
C:\Programming\boost>

编辑:

但如果我将它添加到我的项目中(参考文献 - >链接器 - >输入 - >其他依赖项),我会收到链接器错误,例如:

PyRunnable.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) class boost::python::api::object __cdecl boost::python::api::getitem(class boost::python::api::object const &,class boost::python::api::object const &)" (__imp_?getitem@api@python@boost@@YA?AVobject@123@ABV4123@0@Z)
PyRunnable.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) class boost::python::api::object __cdecl boost::python::api::getattr(class boost::python::api::object const &,char const *)" (__imp_?getattr@api@python@boost@@YA?AVobject@123@ABV4123@PBD@Z)
PyRunnable.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) protected: __thiscall boost::python::detail::str_base::str_base(void)" (__imp_??0str_base@detail@python@boost@@IAE@XZ)

如果我使用dumpbin / symbols,我甚至可以找到未解决的方法。所以,他们在里面,但VS2012以某种方式忽略了它们。 为什么?

在Additional dependencies字段中有:

libboost_system-vc110-mt-1_55.lib
libboost_program_options-vc110-mt-1_55.lib
libboost_filesystem-vc110-mt-1_55.lib

并没有问题。但是如果我在那里添加libboost_python-vc120-mt-1_55.lib,我仍然会得到15个链接器错误。 我做错了什么?

提前谢谢。

1 个答案:

答案 0 :(得分:2)

这是正常的。 dumpbin /exports选项用于显示从PE文件(例如DLL)导出的函数,而不是用于列出COFF库中的函数。

要列出COFF库中的函数,请使用/symbols选项:

dumpbin /symbols libboost_python-vc110-mt-s-1_55.lib