我正在尝试使用boost python为我的库编写一个小包装器 . 我使用Cmake,mingw w64和Python 3.4 .

我的Makefile看起来像这样:

# link python libs ...

set(Boost_USE_STATIC_LIBS OFF)  # focus on this line

# find boost and etc ...

add_library( some STATIC some.cpp ) # a maintainer library
add_library( wrap SHARED wrap.cpp )  # wrapper for python
target_link_libraries( wrap some ${Boost_LIBRARIES}  ${Python_LIBRARIES} )
# ...

这是严格的,构建是成功的,但在这种情况下,Boost动态链接 .


恳求,我想要一个与Boost的静态链接,我正在尝试将开关提升到静态模式 .

set(Boost_USE_STATIC_LIBS ON)

链接崩溃有很多错误 .

wrap.cpp :( . text 0x75):未定义引用_imp___ZN5boost6python6detail11init_moduleER11PyModuleDefPFvvE'wrap.cpp :( . text $ _ZNK5boost6python9type_info4nameEv [__ ZNK5boost6python9type_info4nameEv] 0x18):未定义引用`_imp___ZN5boost6python6detail12gcc_demangleEPKc'

和那样的东西 .

我使用--build-type =完成密钥构建了Boost,并且我完全具有 libboost_python-mgw53-1_60.a . 我很困惑 .

我该如何解决?