at learning_topic/CMakeLists.txt:158 (target_link_libraries): Cannot specify link libraries for target "topic_publisher" which is not built by this project.
时间: 2023-10-19 11:53:38 浏览: 166
这个错误通常是由于在CMakeLists.txt文件中指定了一个目标的链接库,但该目标并不是由当前项目构建的造成的。在这种情况下,你需要检查CMakeLists.txt文件中的target_link_libraries()函数的调用,确保你正在为正确的目标指定链接库。你可以尝试以下几个步骤来解决这个问题:
1. 确保目标名称与你的项目中的目标名称匹配。
2. 检查项目中是否存在名为"topic_publisher"的目标,并确保它在构建过程中被正确定义和构建。
3. 如果目标"topic_publisher"不是由当前项目构建的,你可能需要检查它是否来自另一个项目或库,并相应地进行调整。
希望这些提示对你有所帮助!如果你有更多的问题,请随时提问。
相关问题
CMake Error at robot_vision/CMakeLists.txt:236 (target_link_libraries): Cannot specify link libraries for target "text" which is not built by this project.
这个错误是由于在 CMakeLists.txt 的第 236 行中,你尝试为名为 "text" 的目标指定链接库,但是该目标并不是由当前项目构建的。可能是你在当前的项目中使用了名为 "text" 的外部库。解决方法是检查 CMakeLists.txt 文件中是否正确引用了外部库,并确保该库已正确安装和可用。如果该库不是必需的,你可以尝试删除与它相关的行。
ubuntu16.04运行时报错CMake Error at bobac2_description/CMakeLists.txt:147 (add_dependencies): Cannot add target-level dependencies to non-existent target "bobac2_description_node". The add_dependencies works for top-level logical targets created by the add_executable, add_library, or add_custom_target commands. If you want to add file-level dependencies see the DEPENDS option of the add_custom_target and add_custom_command commands. CMake Error at bobac2_description/CMakeLists.txt:150 (target_link_libraries): Cannot specify link libraries for target "bobac2_description_node" which is not built by this project. -- Configuring incomplete, errors occurred! See also "/home/bobac3/ros_workspace/build/CMakeFiles/CMakeOutput.log". See also "/home/bobac3/ros_workspace/build/CMakeFiles/CMakeError.log". Makefile:2796: recipe for target 'cmake_check_build_system' failed make: *** [cmake_check_build_system] Error 1 CMake Error at bobac2_description/CMakeLists.txt:147 (add_dependencies): Cannot add target-level dependencies to non-existent target "bobac2_description_node". The add_dependencies works for top-level logical targets created by the add_executable, add_library, or add_custom_target commands. If you want to add file-level dependencies see the DEPENDS option of the add_custom_target and add_custom_command commands. CMake Error at bobac2_description/CMakeLists.txt:150 (target_link_libraries): Cannot specify link libraries for target "bobac2_description_node" which is not built by this project. -- Configuring incomplete, errors occurred! See also "/home/bobac3/ros_workspace/build/CMakeFiles/CMakeOutput.log". See also "/home/bobac3/ros_workspace/build/CMakeFiles/CMakeError.log". Makefile:2796: recipe for target 'cmake_check_build_system' failed make: *** [cmake_check_build_system] Error 1
这个错误可能是因为在运行CMake时,找不到名为"bobac2_description_node"的目标。这可能是因为在CMakeLists.txt文件中没有正确地定义目标或源文件。您可以检查一下CMakeLists.txt文件中的目标和源文件是否正确定义。另外,您可以尝试清理并重新构建项目,以确保没有编译错误。您也可以查看CMakeError.log和CMakeOutput.log文件,以获取更多关于错误的详细信息。
阅读全文