Marvin Limjuco
Marvin Limjuco

Reputation: 31

CMake does not find compiler with C++11 support

I am trying to install the FANN library for use in a project. I am using this as my guide but when I run cmake ., I receive this:

`$ cmake .
-- FANN is used as APPLICATION_NAME
-- Try OpenMP CXX flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Success
-- Could NOT find OpenMP (missing:  OpenMP_CXX_FLAGS) 
-- The compiler /usr/bin/c++ has no C++0x, C++11 or C++14 support. FANN will still work with no problem, but the tests will not be able to compile.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/marvin/fann`

even if I have gcc/g++ 4.9 installed. Looking at the instructions from Git hub, the output when running cmake . should be something like this:

`-- The C compiler identification is GNU 4.8.1
-- The CXX compiler identification is GNU 4.8.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- FANN is used as APPLICATION_NAME
-- Try OpenMP C flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Success
-- Try OpenMP CXX flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Success
-- Found OpenMP: -fopenmp  
-- Found PythonInterp: /home/cobalt/anaconda3/bin/python (found version "3.4.3") 
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Performing Test COMPILER_SUPPORTS_CXX14
-- Performing Test COMPILER_SUPPORTS_CXX14 - Success
-- Performing Test COMPILER_SUPPORTS_CXX11
-- Performing Test COMPILER_SUPPORTS_CXX11 - Success
-- Performing Test COMPILER_SUPPORTS_CXX0X
-- Performing Test COMPILER_SUPPORTS_CXX0X - Success
-- The compiler /usr/bin/c++ has C++14 support.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/cobalt/repos/fann`

any help?

Upvotes: 3

Views: 8746

Answers (1)

Antonio Pérez
Antonio Pérez

Reputation: 6962

Even though you have gcc-4.9 installed it's probably not in the standard location, or you have your environment variable CXX pointing to /usr/bin/c++ which is another compiler.

Try running cmake -D CMAKE_CXX_COMPILER /path/to/your/g++-4.9/binary" ..

Upvotes: 2

Related Questions