CMake cl.exe is not able to compile a simple test program
Asked Answered
S

6

10

This is the CMake output:

-- The C compiler identification is MSVC 16.0.30319.1
-- The CXX compiler identification is MSVC 16.0.30319.1
-- Eclipse version is set to 3.6 (Helios). Adjust CMAKE_ECLIPSE_VERSION if this is wrong.
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio
10.0/VC/bin/amd64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio
10.0/VC/bin/amd64/cl.exe -- broken
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.2/Modules/CMakeTestCCompiler.cmake:61 (message):
  The C compiler "C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/amd64/cl.exe" is not able to compile a simple test program.

  It fails with the following output:

   Change Dir: E:/Code/Git/Brendan-C-SFML/build/CMakeFiles/CMakeTmp

I've checked some other questions about this and they say to downgrade to .NET 4.0 but that didn't work for me.

Shepperd answered 31/5, 2015 at 2:41 Comment(4)
Are you actually on a 64-bit OSCreon
Try running that cl.exe from command prompt (not from within cmake) and see if it gives you any other error messgesCreon
Yes I am on 64bit Win7. cl.exe works fine otherwise. Forgot to mention I have just the Win7 SDK installed, no Visual Studio.Shepperd
Possible duplicate of Cmake is Unable to Configure Project for Visual Studios 10 amd64Hark
H
3

In this answer: Cmake is Unable to Configure Project for Visual Studios 10 amd64

I found the solution of my problem.

For me was:

I found that my x64 compilers were destroyed by installing SP 1. Try this update to restore them: http://www.microsoft.com/en-us/download/details.aspx?id=4422

I have updated the compilers and now it works.

Hark answered 19/10, 2015 at 12:52 Comment(0)
O
1

I got a similar problem with Visual Studio 2019 (on Windows 10).

I searched for it and this was the only stackoverflow question that (in the title) was similar to the output that i got from Visual Studio. I wasn't sure if I should create a question to answer it myself, so people who get the same problem probably find this solution. That's why I'm writing it under here.

Anyways, saving the CMake "project" (created by Visual Studio) and restarting the program solved the problem.

Outherod answered 25/4, 2021 at 13:10 Comment(0)
O
0

Try to use a new cvtres.exe to replace Microsoft Visual Studio 10.0\VC\bin\cvtres.exe,I used the one from vs2012, it works! Donot forget to backup.

Occipital answered 19/6, 2018 at 9:25 Comment(0)
S
0

In case Qt Creator 4.7.0 with CMake: I solved this problem by changing generator from 'NMake Makefiles JOM' to 'NMake Makefiles' in Tools->Options->Kits->Kits->CMake generator.

Spoken answered 3/8, 2018 at 12:32 Comment(0)
N
0

If you are using qt with MSVC, don't forget to install cdb.

Natty answered 15/11, 2021 at 7:6 Comment(2)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Arluene
This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From ReviewTaps
H
-1

Enable registry edit access permission on your machine. See steps at Link

Hidalgo answered 4/6, 2024 at 18:48 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.