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。

帮助!提前致谢。

4

2 回答 2

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),但它可能会有所帮助!

于 2016-05-24T22:20:10.637 回答
0

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

于 2016-06-10T03:05:38.030 回答