user3110931
user3110931

Reputation: 301

The CXX compiler identification is unknown

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".

Upvotes: 30

Views: 157408

Answers (15)

Juan José
Juan José

Reputation: 107

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

Upvotes: 4

brokenfoot
brokenfoot

Reputation: 11609

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++

Upvotes: 0

Kim T
Kim T

Reputation: 6416

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!

Upvotes: 12

vincent.zheng
vincent.zheng

Reputation: 1

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

Upvotes: 0

Nightcap79
Nightcap79

Reputation: 642

Make sure that you have installed Clang tools

Upvotes: 0

Pramod Maurya
Pramod Maurya

Reputation: 11

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...!!

Upvotes: 1

Florian
Florian

Reputation: 42842

Those error messages

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

means CMake did find or assume a compiler but it wasn't able to compile a simple test program.

Take a look at CMakeFiles\CMakeError.log and check the error message there to see:

  1. which compiler path/command line CMake did use
  2. what the error message calling the compiler was

    e.g. LINK : fatal error LNK1181: cannot open input file 'kernel32.lib'

If you add --debug-trycompile to the cmake call CMake will even keep the files it has tried to test compile (so you can copy/paste/re-run the command line from the error log in your cmd shell).

The last time I had this problem ...

The last time I had this problem was when my Visual Studio 2012 Professional standard installation did not install any Windows SDK (the error log was showing an missing SDK header).

To verify your SDK installation e.g. check that you have any Resource Compiler installed. It should be in a path similar to:

C:\Program Files (x86)\Microsoft SDKs\Windows\v[some version]\bin\RC.Exe

Since I was missing this - or more accurate any SDK - I installed Windows 8.1 SDK (since Visual Studio 2012 does target Windows 8.x) and voila my CMake was able again to compile the (test) programs.

Reference

Upvotes: 12

Asif Kazmi
Asif Kazmi

Reputation: 21

I faced the same problem. Building and running a project from Visual Studio didn't work for me. However following worked for me:

  • Open command prompt for developers from Visual Studio tools.
  • Goto the directory where cmake.exe is present.
  • Run it.

Lets hope it works for you as well.

Upvotes: 2

Daniel Geier
Daniel Geier

Reputation: 1

If you use CMake 3.4.0, try upgrading to a newer version. A bug concerning this was fixed relatively recently (see the bug report).

Upvotes: 0

Andrey Rubshtein
Andrey Rubshtein

Reputation: 20915

I had the same problem and I had to use the "File -> Delete Cache", since I accidentally configured CMake to use wrong visual studio version.

Upvotes: 0

Rahul Sood
Rahul Sood

Reputation: 109

Make sure you select the proper version of visual Studio. For example, Visual Studio 2012 is version 11.

Upvotes: 0

wangdq
wangdq

Reputation: 1994

I just encounter with this issue, after I uninstalled some MS software. I fixed it by repair visual studio 2012. First go to [Control panel], then select visual studio and repair it,things will go right now.

Upvotes: 0

Jifeng Zhang
Jifeng Zhang

Reputation: 5147

I had similar problem also, if you are using Microsoft Visual Studio 2012, that might be because of update of KB2781514 is missing.

After I installed following update, CMake start to detect Visual Studio 2012 c/c++ compilers correctly.

http://www.microsoft.com/en-us/download/details.aspx?id=36020

Upvotes: 2

Tonmoy
Tonmoy

Reputation: 557

Same problem here with cmake 2.8.12 and visual studio 10. Cmake may not be able to find the compiler. I solved the problem by uninstalling latest version and installed cmake 2.8.10.

Upvotes: 0

Fuvizzo
Fuvizzo

Reputation: 269

I had the same issue and fixed it running cmake as Admin

Upvotes: 11

Related Questions