0

尝试制作我下载的程序时出现以下错误。

CMakeFiles/ptcloud_vslam_node.dir/src/nodes/ptcloud_vslam_node.cpp.o:未定义对符号'pcl::console::print(pcl::console::VERBOSITY_LEVEL, char const*, ...)'的引用

/usr/bin/ld: 注意:'pcl::console::print(pcl::console::VERBOSITY_LEVEL, char const*, ...)' 在 DSO /opt/ros/groovy/lib/libpcl_common 中定义。 so.1.6 所以尝试将它添加到链接器命令行

/opt/ros/groovy/lib/libpcl_common.so.1.6:无法读取符号:无效操作

我尝试在我的 cmake 文件中添加以下内容

    LINK_DIRECTORIES(/opt/ros/groovy/lib/libpcl_common.so.1.6)
    TARGET_LINK_LIBRARIES(ptcloud_vslam_node libpcl_common.so.1.6)

但是在运行 cmake 时出现以下错误

CMakeLists.txt:51 (TARGET_LINK_LIBRARIES) 处的 CMake 错误:无法为此项目构建的目标“ptcloud_vslam_node”指定链接库。

我应该对我的 cmake 文件进行哪些修改以修复链接错误?

非常感谢

4

1 回答 1

1

It says "Link directories" but you are passing it an actual library, the error is unhappy because for some reason it wants to build ptcloud_vslam_node, it doesn't seem to realise that you are trying to specify it.

Please post more information and add a comment to this answer, and I'll check back.

Symbol not found when using template defined in a library

That will explain how linking works, then you'll perhaps better understand errors.

于 2013-09-09T09:21:41.907 回答