CMake Error at plumbing_pub_sub/CMakeLists.txt:137 (add_executable): Cannot find source file:
时间: 2023-12-11 11:42:01 浏览: 426
引用\[1\]:CMake Error at plumbing_pub_sub/CMakeLists.txt:148 (add_dependencies): The dependency target "plumbing_pub_sub_generate_message_cpp" of target "demo03_pub_person" does not exist.
引用\[2\]:CMake Error at CMakeLists.txt:4 (CMAKE_MINIMUM_REQUIRED): CMake 3.0.2 or higher is required. You are running version 2.8.12.2-- Configuring incomplete, errors occurred!
引用\[3\]:1、下载:curl -O https://cmake.org/files/v3.6/cmake-3.6.0-Linux-x86_64.tar.gz 2、解压:tar -zxvf cmake-3.6.0-Linux-x86_64.tar.gz 注意:这个压缩包不是源码包,解压后直接用。 3、增加环境变量,使其成为全局变量: vim /etc/profile 在文件末尾处增加以下代码 export PATH=$PATH:/lnmp/src/cmake-3.6.0-Linux-x86_64/bin 注意:写自己刚安装cmake的bin的路径 使修改的文件生效 source /etc/profile 4、查看环境变量: echo $PATH 5、检查cmake版本: cmake --version
问题: CMake Error at plumbing_pub_sub/CMakeLists.txt:137 (add_executable): Cannot find source file:
回答: 根据引用\[1\]中的错误信息,CMake在执行add_dependencies时报错,提示目标"plumbing_pub_sub_generate_message_cpp"不存在。这可能是由于CMakeLists.txt文件中的依赖关系设置有误导致的。另外,引用\[2\]中的错误信息显示你正在使用的CMake版本过低,需要使用CMake 3.0.2或更高版本。你可以根据引用\[3\]中的步骤下载并安装最新版本的CMake,并将其添加到全局环境变量中。这样可以解决CMake版本不兼容的问题。至于CMake Error at plumbing_pub_sub/CMakeLists.txt:137 (add_executable): Cannot find source file:的具体原因,需要查看CMakeLists.txt文件中的代码,确认是否正确指定了源文件的路径。
#### 引用[.reference_title]
- *1* [ROS通信部分编译错误](https://blog.csdn.net/m0_44999129/article/details/123158488)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* *3* [CMake安装或CMake Error at CMakeLists](https://blog.csdn.net/banyu0052/article/details/101946043)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文