Visual Studio 2017的CMake生成问题
使用命令行中的Visual Studio 2017的CMake生成问题,cmake,Cmake,使用命令行中的cmake,我得到: "== Building Windows-Release ==" -- Building for: Visual Studio 15 2017 -- The C compiler identification is unknown -- The CXX compiler identification is unknown CMake Error at CMakeLists.txt:2 (project): No CMAKE_C_COMPILER could b
cmake
,我得到:
"== Building Windows-Release =="
-- Building for: Visual Studio 15 2017
-- 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.
其中CMakeError.log
包含:
Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler:
Build flags:
Id flags:
The output was:
1
Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 31/12/2018 12:54:05.
Project "C:\myproj\CMakeFiles\3.13.1\CompilerIdC\CompilerIdC.vcxproj" on node 1 (default targets).
PrepareForBuild:
Creating directory "Debug\".
Creating directory "Debug\CompilerIdC.tlog\".
InitializeBuildStatus:
Creating "Debug\CompilerIdC.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\CL.exe /c /nologo /W0 /WX- /Od /Oy- /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"Debug\\" /Fd"Debug\vc140.pdb" /Gd /TC /analyze- /errorReport:queue CMakeCCompilerId.c
CMakeCCompilerId.c
c1 : fatal error C1083: Cannot open source file: 'CMakeCCompilerId.c': No such file or directory [C:\myproj\CMakeFiles\3.13.1\CompilerIdC\CompilerIdC.vcxproj]
Done Building Project "C:\myproj\CMakeFiles\3.13.1\CompilerIdC\CompilerIdC.vcxproj" (default targets) -- FAILED.
Build FAILED.
"C:\myproj\CMakeFiles\3.13.1\CompilerIdC\CompilerIdC.vcxproj" (default target) (1) ->
(ClCompile target) ->
c1 : fatal error C1083: Cannot open source file: 'CMakeCCompilerId.c': No such file or directory [C:\myproj\CMakeFiles\3.13.1\CompilerIdC\CompilerIdC.vcxproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.43
...
我试图修复Visual Studio的安装,并重新安装CMake,但似乎没有任何效果。这里也看到了类似的线索,但没有任何帮助。我遇到了与您完全相同的问题。经过很长时间的斗争,我终于找到了解决办法。我不确定这是否是你遇到的同一个问题,但我仍然想写下并重新编码这个奇怪的问题 首先,我还重新安装了cmake,修复了VS,并在其中添加了许多组件,修复了(制动)多路径环境,但所有这些都不起作用,我打赌问题不是因为这些问题 作为两条信息:
- C编译器标识未知
- CXX编译器标识未知
希望这些可以帮助您。文件
C:\myproj\CMakeFiles\3.13.1\CompilerIdC\cmakccompilerid.C
是否存在?它应该位于C:\myproj\cmakfiles\3.13.1\CompilerIdC\CompilerIdC.vcxproj
旁边。这是所有项目都会发生还是只有这一个?另外,我通常会看到一行——选择WindowsSDK版本10.0.17763.0以Windows6.1.7601为目标。
,但这似乎没有。cmake
的命令行中是否有异常的内容?它确实存在。它发生在所有cmake
项目中。不管Visual Studio如何,我都安装了Windows 10 SDK,但这似乎没有帮助。这很奇怪。也许将构建文件夹放在C:\中是一个奇怪的文件权限问题。您可以尝试直接在Visual Studio中打开C:\myproj\CMakeFiles\3.13.1\CompilerIdC\CompilerIdC.vcxproj
,查看IDE是否可以读取并编译该文件。另外,如果在此文件夹中使用VisualStudio创建项目模板,这是否有效?可能是Visual Studio工作不正常?