在Ninja Generator上运行,目前无法在CMake中运行测试代码,输出如下:
有什么想法吗
严重性代码描述项目文件行抑制状态错误CMake错误位于C:/Program Files(x86)/Microsoft Visual Studio/2019/Community/Common 7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.20/Modules/CMakeTestCCompiler.cmake:66(消息):C编译器
"C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe"
字符串
无法编写简单的测试程序。
失败,输出如下:
Change Dir: C:/Users/jamieza/source/repos/CMakeProject2/out/build/x64-Debug/CMakeFiles/CMakeTmp
Run Build Command(s):C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe cmTC_59a30 && [1/2] Building C object CMakeFiles\cmTC_59a30.dir\testCCompiler.c.obj
[2/2] Linking C executable cmTC_59a30.exe
FAILED: cmTC_59a30.exe
cmd.exe /C "cd . && "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_59a30.dir --rc=rc --mt=CMAKE_MT-NOTFOUND --manifests -- C:\PROGRA~2\MIB055~1\2019\COMMUN~1\VC\Tools\MSVC\1429~1.301\bin\Hostx64\x64\link.exe /nologo CMakeFiles\cmTC_59a30.dir\testCCompiler.c.obj /out:cmTC_59a30.exe /implib:cmTC_59a30.lib /pdb:cmTC_59a30.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
RC Pass 1: command "rc /fo CMakeFiles\cmTC_59a30.dir/manifest.res CMakeFiles\cmTC_59a30.dir/manifest.rc" failed (exit code 0) with the following output:
The system cannot find the file specified
ninja: build stopped: subcommand failed.
型
CMake将无法正确生成此项目。C:/Program Files(x86)/Microsoft Visual Studio/2019/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.20/Modules/CMakeTestCCompiler.cmake 66
1条答案
按热度按时间ojsjcaue1#
我遇到了同样的问题,因为没有答案张贴,我会分享的解决方案,为我工作。控制台的构建输出并没有给予很多线索。我不得不在CMakeFiles下查找CMakeError.log。在我的例子中,它无法打开和链接'kernel32.lib',但该信息不在VS构建输出窗口中。
字符串
cmake上的这篇文章帮助了我。我不得不修改VS 2019安装并添加C++/CLI组件。之后一切都很顺利。