【发布时间】:2019-02-21 23:05:11
【问题描述】:
我在 ubuntu 中有多个版本的 GCC,gcc-4.8 和 gcc-5。使用gcc -v会得到gcc version 4.8.4,所以看起来默认是4.8,但我需要使用gcc-5。
我试过How to specify new GCC path for CMake:
export CC=/usr/bin/gcc-5
export CXX=/usr/bin/g++-5
// find the path by using 'which gcc-5'
具体:
-DCMAKE_C_COMPILER=/usr/bin/gcc-5
-DCMAKE_CXX_COMPILER=/usr/bin/g++-5
但报错:
ubuntu@skc:~/jumanpp-2.0.0-rc2/bld$ cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/Jumanpp -DCMAKE_C_COMPILER=/usr/bin/gcc-5 -DCMAKE_CXX_COMPILER=/usr/bin/g++-5
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- Check for working C compiler: /usr/bin/gcc-5
-- Check for working C compiler: /usr/bin/gcc-5 -- broken
CMake Error at /usr/share/cmake-3.2/Modules/CMakeTestCCompiler.cmake:61 (message):
The C compiler "/usr/bin/gcc-5" is not able to compile a simple test
program.
【问题讨论】:
标签: c++ gcc cmake ubuntu-14.04