I tried making a minimalistic try to learn how to use cmake with c++. When I tried it my first time, it worked. Then I did it in a second folder and I got compile errors when running make. All I did was run cmake .
and then make
. What does the error mean?
error
Scanning dependencies of target hello
[ 50%] Building CXX object CMakeFiles/hello.dir/main.cc.o
c++: error: g++: No such file or directory
CMakeFiles/hello.dir/build.make:62: recipe for target 'CMakeFiles/hello.dir/main.cc.o' failed
make[2]: *** [CMakeFiles/hello.dir/main.cc.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/hello.dir/all' failed
make[1]: *** [CMakeFiles/hello.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
CMakeLists.txt
cmake_minimum_required(VERSION 3.10.2) # set version to same as on system
project(hello) # set project name to something
add_executable(hello main.cc) # the executable should be called "hello"
SET(CMAKE_CXX_FLAGS "g++ -std=c++17 -pedantic -Wall -Wextra -Werror -Weffc++")
main.cc:
int main()
{
}