Compilation errors with CMake

I am trying to compile a git project, and I ran into some problems with CMake. Initially, he did not find the C ++ compiler and caused an error:

cmake .. 

No CMAKE_CXX_COMPILER.

Tell CMake where to find the compiler by setting either the "CXX" environment variable or writing the CMMA CMAKE_CXX_COMPILER CMake cache to the full path to the compiler or the name of the compiler if it is in PATH.

So I did:

 CXX="gcc" cmake .. 

Another error was caused:

- CXX compiler id unknown
- Check the operation of the CXX compiler: / usr / bin / gcc
- Check the operation of the CXX compiler: / usr / bin / gcc - broken
CMake error in / usr / share / cmake -3.0 / Modules / CMakeTestCXXCompiler.cmake: 54 (message):
The C ++ compiler "/ usr / bin / gcc" cannot compile a simple test program.

How can I solve this error and compile the project?

+5
source share
2 answers

You are trying to use the C gcc compiler as C ++, which is incorrect.

You need to install g++ or another C ++ compiler.

+6
source

You should try installing build-essential if you haven’t.

try it

 sudo apt-get update sudo apt-get install -y build-essential 
+12
source

All Articles