我在让QHull C++接口在catkin项目中工作时遇到了一些困难。我的项目编译得很好,我已经指定了链接器要使用的库,但是它无法链接到以下错误消息。
CMakeFiles/path_to/my_code.cpp.o: In function `main':
my_code.cpp:(.text+0x17ab): undefined reference to `orgQhull::RboxPoints::RboxPoints()'
my_code.cpp:(.text+0x182a): undefined reference to `orgQhull::PointCoordinates::appendPoints(std::istream&)'
my_code.cpp:(.text+0x1839): undefined reference to `orgQhull::Qhull::Qhull()'
my_code.cpp:(.text+0x1857): undefined reference to `orgQhull::Qhull::runQhull(orgQhull::RboxPoints const&, char const*)'
my_code.cpp:(.text+0x18aa): undefined reference to `orgQhull::Qhull::outputQhull(char const*)'
my_code.cpp:(.text+0x19d0): undefined reference to `orgQhull::Qhull::~Qhull()'
my_code.cpp:(.text+0x19ee): undefined reference to `orgQhull::RboxPoints::~RboxPoints()'
my_code.cpp:(.text+0x1c10): undefined reference to `orgQhull::Qhull::~Qhull()'
my_code.cpp:(.text+0x1c38): undefined reference to `orgQhull::RboxPoints::~RboxPoints()'
CMakeFiles/build_path/my_code.cpp.o: In function `orgQhull::Qhull::setOutputStream(std::ostream*)':我安装了以下软件包,以获取共享对象和开发文件。
我不知道这是否与问题有关,但是查看libqhull.so共享对象,其中没有符号。
####:/usr/lib/x86_64-linux-gnu$ nm -g libqhull.so
nm: libqhull.so: no symbols有谁有经验让这个在linux上工作吗?任何帮助都将不胜感激。
发布于 2017-02-21 16:11:25
我用的是ROS Indigo,这对我有用:
SET(qhullDir path_to_qhull_code)
INCLUDE_DIRECTORIES(${qhullDir}/src/libqhullcpp)
INCLUDE_DIRECTORIES(${qhullDir}/src)
LINK_DIRECTORIES(${qhullDir}/build)
INCLUDE_DIRECTORIES(${qhullDir}/src/libqhullcpp)
INCLUDE_DIRECTORIES(include)
SET(qhullLibs qhullcpp qhull_r)
add_library(${PROJECT_NAME}_library
src/myClass.cpp)
add_executable(libExample
src/myrunnable.cpp)
target_link_libraries(libExample
${PROJECT_NAME}_library ${qhullLibs})
SET_TARGET_PROPERTIES(libExample PROPERTIES
COMPILE_DEFINITIONS "qh_QHpointer")我正在用cmake从源代码编译qhull。
也许这能帮上忙。
https://stackoverflow.com/questions/41592153
复制相似问题