我正在尝试从GitHub构建一个项目,即这个项目https://github.com/notAlaanor/cpp-type-highlighter(这只是另一个人的仓库)。
但是尝试编译之后,我得到了类似的错误信息:
-- The C compiler identification is MSVC 19.20.27404.0
-- The CXX compiler identification is MSVC 19.20.27404.0
-- Check for working C compiler: E:/VS19/VC/Tools/MSVC/14.20.27404/bin/Hostx86/x86/cl.exe
-- Check for working C compiler: E:/VS19/VC/Tools/MSVC/14.20.27404/bin/Hostx86/x86/cl.exe -- broken
CMake Error at C:/Program Files/CMake/share/cmake-3.13/Modules/CMakeTestCCompiler.cmake:52 (message):
The C compiler
"E:/VS19/VC/Tools/MSVC/14.20.27404/bin/Hostx86/x86/cl.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/theha/cpp-type-highlighter/build/CMakeFiles/CMakeTmp
Run Build Command:"nmake" "/nologo" "cmTC_b368f\fast"
E:\VS19\VC\Tools\MSVC\14.20.27404\bin\HostX64\x64\nmake.exe -f CMakeFiles\cmTC_b368f.dir\build.make /nologo -L CMakeFiles\cmTC_b368f.dir\build
Building C object CMakeFiles/cmTC_b368f.dir/testCCompiler.c.obj
E:\VS19\VC\Tools\MSVC\14.20.27404\bin\Hostx86\x86\cl.exe @C:\Users\theha\AppData\Local\Temp\nm8555.tmp
testCCompiler.c
Linking C executable cmTC_b368f.exe
"C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_b368f.dir --manifests -- E:\MinGW\bin\ld.exe /nologo @CMakeFiles\cmTC_b368f.dir\objects1.rsp @C:\Users\theha\AppData\Local\Temp\nm85C3.tmp
LINK Pass 1: command "E:\MinGW\bin\ld.exe /nologo @CMakeFiles\cmTC_b368f.dir\objects1.rsp /out:cmTC_b368f.exe /implib:cmTC_b368f.lib /pdb:C:\Users\theha\cpp-type-highlighter\build\CMakeFiles\CMakeTmp\cmTC_b368f.pdb /version:0.0 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:CMakeFiles\cmTC_b368f.dir/intermediate.manifest CMakeFiles\cmTC_b368f.dir/manifest.res" failed (exit code 1) with the following output:
E:\MinGW\bin\ld.exe: cannot find /nologo: No such file or directory
E:\MinGW\bin\ld.exe: cannot find /out:cmTC_b368f.exe: No such file or directory
E:\MinGW\bin\ld.exe: cannot find /implib:cmTC_b368f.lib: No such file or directory
E:\MinGW\bin\ld.exe: cannot find /pdb:C:\Users\theha\cpp-type-highlighter\build\CMakeFiles\CMakeTmp\cmTC_b368f.pdb: Invalid argument
E:\MinGW\bin\ld.exe: cannot find /version:0.0: No such file or directory
E:\MinGW\bin\ld.exe: cannot find /debug: No such file or directory
E:\MinGW\bin\ld.exe: cannot find /INCREMENTAL: No such file or directory
E:\MinGW\bin\ld.exe: cannot find /subsystem:console: No such file or directory
E:\MinGW\bin\ld.exe: cannot find kernel32.lib: No such file or directory
E:\MinGW\bin\ld.exe: cannot find user32.lib: No such file or directory
E:\MinGW\bin\ld.exe: cannot find gdi32.lib: No such file or directory
E:\MinGW\bin\ld.exe: cannot find winspool.lib: No such file or directory
E:\MinGW\bin\ld.exe: cannot find shell32.lib: No such file or directory
E:\MinGW\bin\ld.exe: cannot find ole32.lib: No such file or directory
E:\MinGW\bin\ld.exe: cannot find oleaut32.lib: No such file or directory
E:\MinGW\bin\ld.exe: cannot find uuid.lib: No such file or directory
E:\MinGW\bin\ld.exe: cannot find comdlg32.lib: No such file or directory
E:\MinGW\bin\ld.exe: cannot find advapi32.lib: No such file or directory
E:\MinGW\bin\ld.exe: cannot find /MANIFEST: No such file or directory
E:\MinGW\bin\ld.exe: cannot find /MANIFESTFILE:CMakeFiles\cmTC_b368f.dir/intermediate.manifest: Invalid argument
CMakeFiles\cmTC_b368f.dir/manifest.res: file not recognized: file format not recognized
NMAKE : fatal error U1077: '"C:\Program Files\CMake\bin\cmake.exe"' : return code '0xffffffff'
Stop.
NMAKE : fatal error U1077: 'E:\VS19\VC\Tools\MSVC\14.20.27404\bin\HostX64\x64\nmake.exe' : return code '0x2'
Stop.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:3 (project)
-- Configuring incomplete, errors occurred!
如果我运行命令where clang
,则会得到输出:
C:\Program Files\LLVM\bin\clang.exe
我也通过cmake ..
运行命令vcvarsall.bat
,因此,在运行cmake ..
之前,我运行了call "E:\VS19\VC\Auxiliary\Build\vcvarsall.bat" amd64
。
我在Windows 10上构建,安装了Visual Studio 2019和MinGW。
如何解决该问题?
答案 0 :(得分:-1)
如果已下载解决方案,则可能必须重新定位并重建解决方案。
右键单击解决方案->重新定位解决方案->选择相关/最新的SDK。
右键单击解决方案->重建解决方案。
希望有帮助。