设置catkin工作区时出错

问题描述 投票:0回答:3

我正在关注这些教程:

在步骤catkin_make中我收到错误:

-- The C compiler identification is unknown
CMake Error at /usr/share/cmake-2.8/Modules/CMakeDetermineCCompiler.cmake:186 (configure_file):
configure_file Problem configuring file

-- The CXX compiler identification is unknown
CMake Error at /usr/share/cmake-2.8/Modules/CMakeDetermineCXXCompiler.cmake:185 (configure_file):
configure_file Problem configuring file

-- Check for working C compiler: /usr/bin/cc
CMake Error at /usr/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:47 (try_compile):
Unknown extension ".c" for file

/home/manoj/catkin_ws/build/CMakeFiles/CMakeTmp/testCCompiler.c

try_compile() works only for enabled languages.  Currently these are:

C CXX

See project() command to enable other languages.

-- Check for working C compiler: /usr/bin/cc -- broken
CMake Error at /usr/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:61 (message):
The C compiler "/usr/bin/cc" is not able to compile a simple test program.

It fails with the following output:

我尝试将环境变量 CC 和 CXX 设置为 /usr/bin/gcc 和 /usr/bin/g++,但没有用。

还尝试了全新安装cmake,仍然没有用。我在 Linux 的 Windows 子系统上使用 Ubuntu。

救命!预先感谢。

cmake ros catkin
3个回答
1
投票

尝试将以下行添加到您的 CMakeLists.txt

before the catkin_package()
:

set(CMAKE_C_COMPILER "/usr/bin/gcc")
set(CMAKE_CXX_COMPILER "/usr/bin/g++")

有时,最好清理你的构建(通常通过删除 catkin_ws 中的 /devel 和 /build 文件夹)并进行新的

catkin_make

郑重声明,不建议使用此方法(请参阅此处,方法 3),但它可能会有所帮助!


0
投票

错误出在 WSL 上的 cmake 上。修复是入站的。报告、讨论和重现在这里:Windows 上的 Bash:Bugs


0
投票

删除构建文件夹中的 CMakeCache.txt 对我有用。

© www.soinside.com 2019 - 2024. All rights reserved.