我的问题类似于以下问题:Problems generating solution for VS 2017 with CMake,但是该解决方案对我不起作用。
在针对VS 2017的开发人员命令提示符中运行 cmake 时,出现错误(来自CMakeError.log
):
LINK:致命错误LNK1104:无法打开文件“ ucrtd.lib” [E:\ Projects \ My Project \ VS \ CMakeFiles \ 3.14.4 \ CompilerIdC \ CompilerIdC.vcxproj]
但是文件ucrtd.lib
位于Windows Kits
文件夹中。
回声%LIB%
D:\ Program Files(x86)\ Microsoft Visual Studio 2017社区\ VC \ Tools \ MSVC \ 14.16.27023 \ lib \ x86; C:\ Program Files(x86)\ Windows Kits \ NETFXSDK \ 4.6.1 \ lib \ um \ x86; C:\ Program Files(x86)\ Windows Kits \ 10 \ lib \ 10.0.17763.0 \ ucrt \ x86 ; C:\ Program Files(x86)\ Windows Kits \ 10 \ lib \ 10.0.17763.0 \ um \ x86;
dir“ C:\ Program Files(x86)\ Windows Kits \ 10 \ lib \ 10.0.17763.0 \ ucrt \ x86 \” / w / b
libucrt.lib
libucrtd.lib
ucrt.lib
ucrtd.lib
我还尝试手动运行CMakeError.log
中列出的build命令,它成功,没有错误。
CL.exe / c / nologo / W0 / WX- /诊断:经典/ Od / Oy- / D _MBCS / Gm- / EHsc / RTC1 / MDd / GS / fp:precise / Zc:wchar_t / Zc:forScope / Zc:内联/ Fo“ Debug \” /Fd"Debug\vc141.pdb“ / Gd / TC / analyze- / FC / errorReport:queue CMakeCCompilerId.c
link.exe / ERRORREPORT:QUEUE /OUT:".\CompilerIdC.exe“ / INCREMENTAL:NO / NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib / MANIFEST / MANIFESTUAC:“ level ='asInvoker'uiAccess ='false'” / manifest:embed /PDB:".\CompilerIdC.pdb“ / SUBSYSTEM:CONSOLE / TLBID: 1 / DYNAMICBASE / NXCOMPAT /IMPLIB:".\CompilerIdC.lib“ / MACHINE:X86 / SAFESEH Debug \ CMakeCCompilerId.obj
因此,cmake似乎无法识别环境变量,或者我错过了一些重要步骤吗?
cmake版本为3.14.4
visual studio版本是15.9.7
答案 0 :(得分:0)
如this CMake论坛中所述,可能有必要明确告诉CMake您安装了哪个特定Windows版本。考虑到您已经安装了10.0.17763.0
版,包括以下定义,会将CMake定向到该版本:
cmake -DCMAKE_SYSTEM_VERSION=10.0.17763.0
这里是CMAKE_SYSTEM_VERSION
的{{3}}。