VS 2010和CMake:'rc'未被识别为内部或外部命令

时间:2017-02-12 17:05:43

标签: visual-studio-2010 cmake

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

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

有谁知道原因:

'rc' is not recognized as an internal or external command,
operable program or batch file."  
会是吗?

我假设这也导致cl.exe被破坏错误?

1 个答案:

答案 0 :(得分:4)

我上次遇到此问题时,我的Visual Studio 2012 Professional标准安装没有安装任何Windows SDK(错误日志显示缺少SDK标头)。

验证您的SDK安装,例如检查您是否安装了任何资源编译器。它应该在类似于:

的路径中
C:\Program Files (x86)\Microsoft SDKs\Windows\v[some version]\bin\RC.Exe

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

<强>参考