boost.python未定义的符号问题

时间:2015-01-06 22:32:35

标签: c++ boost-python undefined-symbol

我正在尝试使用boost.python编译项目,但遇到以下问题

undefined symbol:    _ZN5boost6python7objects23register_dynamic_id_auxENS0_9type_infoEPFNSt3__14pairIPvS2_EE

我正在使用cmake构建它

...
# Find necessary packages
find_package( PythonLibs 2.7 REQUIRED )
include_directories( ${PYTHON_INCLUDE_DIRS} )

find_package( Boost COMPONENTS python REQUIRED )
include_directories( ${Boost_INCLUDE_DIR} )

add_library(test_py SHARED ${SOURCE_FILES})

list(APPEND CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
target_link_libraries(test_py lib1)
target_link_libraries(test_py boost_python)
target_link_libraries(test_py python2.7)
set_target_properties(test_py PROPERTIES PREFIX "")

之后我有安装脚本将所有文件复制到目录test_py,并带有 init .py文件

from test_py import *

我缺少什么想法?

干杯,迈克

1 个答案:

答案 0 :(得分:0)

设置LD_LIBRARY_PATH修复此问题。