设置catkin工作区时出错

时间:2016-05-24 16:54:29

标签: cmake ros catkin

我正在关注这些教程:

在步骤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子系统Linux上使用Ubuntu。

帮助!在此先感谢。

2 个答案:

答案 0 :(得分: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

为了记录,不推荐这种方法(参见here,方法3),但它可能会有所帮助!

答案 1 :(得分:0)

错误在于WSL上的cmake。修复是入站的。报告,讨论& repro在这里:Bash on Windows: Bugs