5

I am currently trying to compile a project in CMake 3.10.0 and it keeps giving the above error box and this

    The C compiler identification is unknown
    The CXX compiler identification is unknown
    CMake Error at CMakeLists.txt:2 (project):
        No CMAKE_C_COMPILER could be found.



    CMake Error at CMakeLists.txt:2 (project):
        No CMAKE_CXX_COMPILER could be found.



    Configuring incomplete, errors occurred!
    See also "C:/build/CMakeFiles/CMakeOutput.log".
    See also "C:/build/CMakeFiles/CMakeError.log".

I am currently running Microsoft Visual Studio 15 2017 and when I am configuring it, I am using x64.

5 Answers 5

9

i had same problem when using vs 2015 but after installing vs 2017 it solved. I think you should repair your visual studio 2017 and try again. if cmake don`t let you configure with new vs in file tab clear use "delete cache" and try again

1
  • 3
    In CMake 3.14, "delete cache" is under the File tab
    – takanuva15
    Feb 14, 2019 at 18:10
4

When you installed Visual Studio 2017, did you install the Visual C++ compilers? It's not enabled by default. Go to Add or Remove programs and try Repairing/Modifying it to make sure Visual C++ is included.


This is going to sound like a stupid suggestion but if you've just installed VS 2017, make sure you're actually able to compile a sample C++ solution. Yes, you would be surprised by the amount of people I've seen with this error that simply didn't realize their compiler wasn't installed.


My third suggestion would be to try opening the x86 or x64 Native Tools Command Prompt and try running your CMake build again. The problem, as I'm sure you've noticed haha, is that it can't find your C compilers. Running these Command Prompts will ensure your correct environment variables are set. If this fails, your C compilers are missing and you need to re-install VS2017. If this works that means there's an issue with your environment PATH.

8
  • thanks for responding, I've tried the first 2 solutions to no success, how do I go about the 3rd solution?
    – shaddles
    Nov 29, 2017 at 17:31
  • When you say with no success, do you mean that you were actually able to build a c++ program in Visual Studio and CMake is still not working? @shaddles Or do you mean you weren't able to build a C++ program and therefore CMake is not working as well? As far as the third suggestion, to open the Visual Studio Command prompts you just go to: Start > Visual Studio 2017 > x86 Native Tools Command Prompt for VS 2017 (or x64 Native Tools Command Prompt for VS 2017)
    – Chris
    Nov 29, 2017 at 17:49
  • I was able to build a C++ program in Visual Studio, also just tried to configure the build while the command prompt was open and I am still getting the same error
    – shaddles
    Nov 29, 2017 at 17:50
  • @shaddles Hmm... Interesting. I remember one of my coworkers having the same issue a few years ago but I can't remember what he/I did to resolve it.. Another stupid question for you. CMake isn't installed on a separate drive is it? If it isn't, try uninstalling CMake completely and use a 3.6.x version - 64 bit install. When installing, make sure to install for all users (so that it adds it to your system PATH).
    – Chris
    Nov 29, 2017 at 18:36
  • Downloaded and installed 3.6.x but it doesn't allow me to configure with the current version of Visual Studio 2017.
    – shaddles
    Nov 30, 2017 at 17:52
0

First step, Click the File, select Delete Cache, Second step, Click the Configure, select the VS15 2017, then Done. enter image description here

enter image description here enter image description here

0

To Solve the problem, I just downloaded the last version of the opencv and opencv_contrib repositories(both on the same branch named '3.4').

0

Another version of this error occurred in my case when I wanted to build librealsense from source using cmake, in my case the silly error was providing the source code path in librealsense E:\librealsense-2.49.0\src rather i should have provided E:\librealsense-2.49.0 alone. this worked for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.