gpt4 book ai didi

c++ - CMAKE错误: "Cannot open source file" : 'CMakeCCompilerId.c'

转载 作者:行者123 更新时间:2023-12-01 23:29:55 25 4
gpt4 key购买 nike

我正在尝试运行一个可在 Windows 和 Linux 上运行的 CMAKE 项目。当我尝试运行 CMAKE 生成构建文件时,出现以下错误:

enter image description here

我检查了其他帖子是否有此错误,其中大多数建议重新安装 Visual Studio,但这没有帮助。

检查错误日志给了我这个:

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 1/11/2019 15:31:21.
Project "C:\Users\user\Documents\projects\dsa_opengl_examples\build\CMakeFiles\3.13.2\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\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\CL.exe /c /nologo /W0 /WX- /diagnostics:classic /Od /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"Debug\\" /Fd"Debug\vc141.pdb" /Gd /TC /FC /errorReport:queue CMakeCCompilerId.c
CMakeCCompilerId.c
c1 : fatal error C1083: Cannot open source file: 'CMakeCCompilerId.c': No such file or directory [C:\Users\user\Documents\projects\dsa_opengl_examples\build\CMakeFiles\3.13.2\CompilerIdC\CompilerIdC.vcxproj]
Done Building Project "C:\Users\user\Documents\projects\dsa_opengl_examples\build\CMakeFiles\3.13.2\CompilerIdC\CompilerIdC.vcxproj" (default targets) -- FAILED.

Build FAILED.

"C:\Users\user\Documents\projects\dsa_opengl_examples\build\CMakeFiles\3.13.2\CompilerIdC\CompilerIdC.vcxproj" (default target) (1) ->
(ClCompile target) ->
c1 : fatal error C1083: Cannot open source file: 'CMakeCCompilerId.c': No such file or directory [C:\Users\user\Documents\projects\dsa_opengl_examples\build\CMakeFiles\3.13.2\CompilerIdC\CompilerIdC.vcxproj]

0 Warning(s)
1 Error(s)

Time Elapsed 00:00:01.02

有谁知道如何解决c1: fatal error C1083:无法打开源文件:'CMakeCCompilerId.c':没有这样的文件或目录错误?

最佳答案

我也遇到了同样的问题。

跟随@serg06链接到the partial solution后(并从中文翻译)我已经找到了适合我的解决方案:

我使用 WSL 中的 git 和 cmd 中的 cmake,不确定为什么这是一个问题,但安装适用于 Windows 的 git 并从 cmd 重新克隆我的存储库解决了该问题。希望有帮助!

关于c++ - CMAKE错误: "Cannot open source file" : 'CMakeCCompilerId.c' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54155471/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com