CMake Error at bobac2_description/CMakeLists.txt:137 (add_executable): Cannot find source file: src/bobac2_description.cpp Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx CMake Error: CMake can not determine linker language for target: bobac2_description CMake Error: Cannot determine link language for target "bobac2_description". -- Generating done -- Build files have been written to: /home/bobac3/ros_workspace/build Makefile:2810: recipe for target 'cmake_check_build_system' failed make: *** [cmake_check_build_system] Error 1 Invoking "make cmake_check_build_system" failed编译时报以上错,功能包里确实是没有cpp,也明确不用cpp,那么代替cpp的源文件还有可能是哪些呢,或者说是哪些后缀组成的文件名
时间: 2024-03-27 07:36:33 浏览: 29
根据您提供的错误信息,编译时找不到源文件 `src/bobac2_description.cpp`,并且无法确定链接器语言。这意味着在 `bobac2_description` 目录下的 `CMakeLists.txt` 文件中必须存在名为 `src/bobac2_description.cpp` 的源文件,并且必须为可执行文件指定链接器语言。
如果您确定不需要 `cpp` 文件,那么可以在 `CMakeLists.txt` 文件中将可执行文件的源文件列表更改为您要使用的其他源文件。例如,如果您的源文件是 `src/bobac2_description.c`,可以将以下行:
```
add_executable(bobac2_description src/bobac2_description.cpp)
```
更改为:
```
add_executable(bobac2_description src/bobac2_description.c)
```
并且需要为可执行文件指定链接器语言,例如:
```
set_target_properties(bobac2_description PROPERTIES LINKER_LANGUAGE C)
```
这些更改应该可以解决您的问题。如果还有其他问题,请提供更多的错误信息,以便我们更好地帮助您解决问题。
相关问题
CMake Error at plumbing_pub_sub/CMakeLists.txt:137 (add_executable): Cannot find source file:
引用\[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 ]
CMake Error at learning_topic/CMakeLists.txt:159 (add_executable): Cannot find source file:
这个错误通常是由于 CMakeLists.txt 指定的源文件路径不正确或源文件确实不存在所导致的。你需要检查 CMakeLists.txt 文件中是否正确指定了源文件的路径,或者确认源文件是否存在于指定路径下。如果路径正确,并且文件确实存在,那么你可以尝试清除 CMake 缓存,然后重新执行 CMake 构建。你可以使用以下命令清除 CMake 缓存:
```
rm -rf CMakeCache.txt CMakeFiles/
```
然后重新执行 CMake 构建:
```
cmake .
make
```
如果问题仍然存在,你需要进一步检查你的 CMakeLists.txt 文件和项目结构。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)