c++ - 使用 CL (VS Build Tool Compiler) 在 Windows 上构建 C++ 程序

标签 c++ cmake msbuild cl

我尝试使用 CL 从命令行构建程序。 运行下一个命令:

CL -I"C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\include" C:\dev\projects\console-interaction-tester\main.cpp

我发现了错误:

C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\include\crtdefs.h(10): fatal error C1083: ...... corecrt.h: No such file or directory

我尝试了 VS ouptup 中的所有标志,例如 /nologo/TP/DWIN32/D_WINDOWS/W3/GR/EHsc/MDd/Zi/Ob0/Od/RTC1/showIncludes 但它没有工作。

我需要命令示例,什么可以忽略 UniversalCRT,或者说明如何修复路径。我想添加带有 corecrt.h 的包含目录,但经典位置 C:\Program Files (x86)\Microsoft SDKs\Windows Kits\10\includes 不存在!

最佳答案

安装 Windows SDK。

再次运行 VS2017 安装程序,并选择它(或直接选择完整的 C++ 开发包)。

关于c++ - 使用 CL (VS Build Tool Compiler) 在 Windows 上构建 C++ 程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53317744/

相关文章:

c++ - 如何修复错误 "other computer the program can' t start because libgcc_s_dw2-1.dll is missing from your computer“在其他计算机上

msbuild - Nant 删除任务不会删除 msbuild 后的文件

MSBuild SignFile 任务返回 MSB3481 : The signing certificate could not be located

c++ - Visual Studio C++ header

c++ - 在 C++ 中重新排序矩阵乘法的索引

c++ - 链接库 opencv cmake

c++ - 编译 OSL(开放着色语言)时出错,缺少 OPENIMAGEIO_LIBRARY_DIRS

MSBuild - 如何在部署时强制 "AfterBuild"目标?

c++ - 如何访问内存映射 USB 主机 Controller 寄存器?

c++ - 短一 : invalid conversion from char to const char*