Problem with gcc versions, make and cmake.
andylikescodes opened this issue · 1 comments
Hi all, my computer is running on MacOS Sierra 10.12.5. I had two questions regarding to the compilation of the code and using cmake and make.
- I just finish the code in /src and wanted to compile the code. I followed the instructions, creating a "build" folder, and ran
cmake ..
, it gave me this:
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/Work/Documents/udacity/CarND-Extended-Kalman-Filter-Project
Then I ran make
, it gave me this:
make: *** No targets specified and no makefile found. Stop.
It seems like cmake was not able to find the Makefile in the upper directory of folder "build". What would possibly be the cause of the problem?
- Because of the above error message I got, I tried to run
make
directly under the project root directory, it throughs me an error too:
[ 20%] Building CXX object CMakeFiles/ExtendedKF.dir/src/main.cpp.o
In file included from /Users/Work/Documents/udacity/CarND-Extended-Kalman-Filter-Project/src/main.cpp:3:0:
/Users/Work/Documents/udacity/CarND-Extended-Kalman-Filter-Project/src/json.hpp:67:10: error: #error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers"
#error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers"
^
make[2]: *** [CMakeFiles/ExtendedKF.dir/src/main.cpp.o] Error 1
make[1]: *** [CMakeFiles/ExtendedKF.dir/all] Error 2
make: *** [all] Error 2
It seems like I am not having the right gcc version. I checked my gcc version by typing in gcc --version
, and I got
gcc (GCC) 4.8.5
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
I also installed gcc5, gcc6 and gcc7 but I don't know how to specify which version to use. Do I need to do so? I assume the make file contain the instructions to compile the C++ code for this particular project.
Sorry I am new to C++ and compiler. Thank you for your time.
Problem solved. I somehow ran cmake once under the project directory and it created some cmake files. If I run cmake again in the build directory, it does not create the related make files. After I deleted all the cmake generated files under the project directory, and ran cmake ..
in the build folder, the code compiles.