0

I'm trying to build a project on Windows 10 - Home using VS 2010 and CMake. I'm getting the following errors:

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

Does anyone know what the cause of:

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

would be?

I'm assuming that's also causing the cl.exe is broken error?

Tsyvarev
  • 60,011
  • 17
  • 110
  • 153
User137481
  • 223
  • 1
  • 4
  • 14

1 Answers1

5

The last time I had this problem was when my Visual Studio 2012 Professional standard installation did not install any Windows SDK (the error log was showing an missing SDK header).

To verify your SDK installation e.g. check that you have any Resource Compiler installed. It should be in a path similar to:

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

Since I was missing this - or more accurate any SDK - I installed Windows 8.1 SDK (since Visual Studio 2012 does target Windows 8.x) and voila my CMake was able again to compile the (test) programs. I think for Visual Studio 2010 the default would be the Windows 7.0a SDK and for Visual Studio 2015 it would be Windows 10 SDK with Universal C Runtime.

Reference

Florian
  • 39,996
  • 9
  • 133
  • 149
  • 1
    Accepted your answer because the problem was I don't have rc.exe or rc.dll on my computer. Under Microsoft SDKs\Windows I have the folders v7.0A, v7.1, v8.1 and v10.0A. However, none of the folders have rc.exe or rc.dll in them. And v7.1 is an empty folder even I'm supposed to have Windows SDK for Windows 7(7.1) installed. Guess there is something wrong with my installation. – User137481 Feb 12 '17 at 21:06
  • @User137481 During Visual Studio custom installation you can select if you want to install the corresponding Windows SDK. If this is not selected sort of a "minimal version" is installed (containing only includes, libs/dlls). So it's normal that there are some artifacts of Windows SDKs/Kits, but for the resource compiler you need to install the SDK including the "tools". – Florian Feb 13 '17 at 08:44
  • yes that's what I did. I simply accepted the "default" when I did the initial install. So, I re-installed and it's fine now. Thanks. – User137481 Feb 13 '17 at 22:23
  • 1
    Ok, had a similar problem. Used installer of Microsoft Visual Studio 2015 to "change installation". Installed Windows 10 SDK. But rc.exe ended up in e.g. `c:\Program Files (x86)\Windows Kits\10\bin\10.0.15063.0\x64\` instead of my actual Visual Studio path (on drive D:). Also not "Windows SDKs" as in this answer. – Raul Pinto Sep 19 '17 at 16:47