The CXX compiler identification is unknown

Viewed 111044

We are having trouble compiling a project using CMake (v2.8.12) under Windows 7 64Bit using Visual Studio 2012. CMake gives us the following errors. We already tried starting Cmake from the Visual Studio Command Line using admin rights. There seems to have been a similar bug in CMake 2.8.11: http://www.cmake.org/Bug/view.php?id=14440

CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeDetermineCompilerId.cmake:446 (execute_process):
  execute_process given COMMAND argument with no value.
Call Stack (most recent call first):
  C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeDetermineCompilerId.cmake:48 (CMAKE_DETERMINE_COMPILER_ID_VENDOR)
  C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeDetermineCCompiler.cmake:131 (CMAKE_DETERMINE_COMPILER_ID)
  CMakeLists.txt:2 (project)


The C compiler identification is unknown
CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeDetermineCompilerId.cmake:446 (execute_process):
  execute_process given COMMAND argument with no value.
Call Stack (most recent call first):
  C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeDetermineCompilerId.cmake:48 (CMAKE_DETERMINE_COMPILER_ID_VENDOR)
  C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeDetermineCXXCompiler.cmake:127 (CMAKE_DETERMINE_COMPILER_ID)
  CMakeLists.txt:2 (project)


The CXX compiler identification is unknown
Could NOT find SWIG (missing:  SWIG_EXECUTABLE SWIG_DIR) 
CMake Warning at src/CMakeLists.txt:44 (message):
  SWIG was not found.  You will not be able to compile for C#.


Configuring incomplete, errors occurred!
See also "C:/Users/hci/laser_control/CMakeFiles/CMakeOutput.log".
See also "C:/Users/hci/laser_control/CMakeFiles/CMakeError.log".
15 Answers

I was getting the terminal output:

The C compiler identification is unknown
The CXX compiler identification is unknown

I checked the CMakeError.log output:

\build\CMakeFiles\CMakeError.log

It showed the error:

warning MSB8003: The WindowsSDKDir property is not defined. Some build tools may not be found.

Going back to visual Studio I needed to install the Windows 10 SDK:

enter image description here

After installing the SDK and running cmake it showed:

Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.18363.
The C compiler identification is MSVC 19.28.29334.0
The CXX compiler identification is MSVC 19.28.29334.0

And built successfully!

cmake:

The cmake assume that you set g++ compiler path accurately.In case due any reason if it did't find compiler path{/usr/bin/g++} then it throw an error like:

           **The CXX compiler identification is unknown**

So given step will short out this error:

  • Locate your compiler CXX path{for g++ path under Linux is :/usr/bin/g++}

  • Set the Compiler Path and export it configuration: PATH=/usr/bin:$PATH;export PATH

  • Export compiler like : export CXX=/usr/bin/g++-7

Here we assume that g++,cmake,build-essential install in your Linux system...!!

For some reason, deleting the build folder in my machine, solved the issue.

Make sure that you have installed Clang tools

open tools -> Get tools and features, select individual components, search cmake, then uninstall cmake and then re-install cmake, when complete, restart your computer.

I was seeing this on ubuntu - issue was cmake was assuming clang++ as c compiler.

CMake Error at /usr/share/cmake-3.10/Modules/CMakeTestCCompiler.cmake:52 (message):
  The C compiler
    "/usr/bin/clang++-9"

To fix it, export C, C++ compiler paths:

 export CC=/usr/bin/clang
 export CXX=/usr/bin/clang++
Related