VS 2010 和 CMake:“rc”不被识别为内部或外部命令

Use*_*481 0 cmake visual-studio-2010

我正在尝试使用 VS 2010 和 CMake 在 Windows 10 - Home 上构建一个项目。我收到以下错误:

zutil.c  
lib -nologo -out:zlib.lib adler32.obj compress.obj crc32.obj deflate.obj gzclose.obj gzlib.obj gzread.obj  gzwrite.obj infback.obj inflate.obj inftrees.obj inffast.obj trees.obj uncompr.obj zutil.obj   

rc /dWIN32 /r /fozlib1.res ./win32/zlib1.rc   
'rc' is not recognized as an internal or external command,
operable program or batch file.   

NMAKE : fatal error U1077: 'rc' : return code '0x1'
Stop.  
*.dll   
The system cannot find the file specified.
        0 file(s) copied.  

Setting environment for using Microsoft Visual Studio 2010 x86 tools.  
The system cannot find the file specified.  
-- The C compiler identification is MSVC 16.0.40219.1  
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/cl.exe   
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/cl.exe -- broken   

CMake Error at C:/Program Files (x86)/CMake/share/cmake3.6/Modules/CMakeTestCCompiler.cmake:61 (message):


The C compiler "C:/Program Files (x86)/Microsoft Visual Studio
  10.0/VC/bin/cl.exe" is not able to compile a simple test program.

  It fails with the following output:

   Change Dir: C:/Project/build/libpng-1.6.7-build/CMakeFiles/CMakeTmp
Run Code Online (Sandbox Code Playgroud)

有谁知道是什么原因:

'rc' is not recognized as an internal or external command,
operable program or batch file."  
Run Code Online (Sandbox Code Playgroud)

将是?

我假设这也会导致 cl.exe 损坏错误?

Flo*_*ian 5

我最后一次遇到这个问题是我的 Visual Studio 2012 Professional 标准安装没有安装任何 Windows SDK(错误日志显示缺少 SDK 标头)。

验证您的 SDK 安装,例如检查您是否安装了任何资源编译器。它应该位于类似于以下内容的路径中:

C:\Program Files (x86)\Microsoft SDKs\Windows\v[some version]\bin\RC.Exe
Run Code Online (Sandbox Code Playgroud)

由于我错过了这个 - 或者更准确的任何 SDK - 我安装了Windows 8.1 SDK(因为 Visual Studio 2012 确实针对 Windows 8.x),瞧,我的 CMake 能够再次编译(测试)程序。我认为对于 Visual Studio 2010,默认将是Windows 7.0a SDK,对于 Visual Studio 2015,它将是带有Universal C Runtime 的Windows 10 SDK

参考