Visual Studio can't build due to rc.exe

2019-01-03 08:36发布

I've searched online and couldn't find anything that resembled to my issue.

I created an empty C++ project and added a main.cpp with a return and I can't get it to build. Here is the message I receive :

1>------ Build started: Project: Project1, Configuration: Debug Win32 ------
1>LINK : fatal error LNK1158: cannot run 'rc.exe'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Is there somewhere within VS2012 where I can specify where to find this executable? I have installed the Windows 7 SDK and I have this executable at:

C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin

I come from Code::Blocks and using mingw-gcc without any trouble, but lately I've been needing VS for managed implementations so I hope someone has an idea.

17条回答
干净又极端
2楼-- · 2019-01-03 09:29

I'm on Windows 10 x64 and Visual Studio 2017. I copied and pasted rc.exe and rcdll.dll from:

C:\Program Files (x86)\Windows Kits\8.1\bin\x86

to

C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64

it's works with: ( qt creator 5.7.1)

查看更多
看我几分像从前
3楼-- · 2019-01-03 09:29

Add to your environment variable window sdk 8.1 path

C:\Program Files (x86)\Windows Kits\8.1\bin\x64

then open Visual studio x64 Native tools command prompt and enter

vcvarsall.bat

查看更多
冷血范
4楼-- · 2019-01-03 09:31

This might be a little outdated. But if copying the rc.exe and exdll.dll did not work, there is a chance that the windows sdk is not installed properly even if the windows sdk folder exists. You can update the sdk for win 8 in the following page: http://msdn.microsoft.com/en-US/windows/hardware/hh852363 After re-installing the sdk, the problem would get solved. Also make sure that platform toolset is set properly.

查看更多
姐就是有狂的资本
5楼-- · 2019-01-03 09:31

I'm using Windows 7 with VS 2013 (Update 3) and Intel Parallel Studio XE Composer Edition for Fortran Windows (Update 5). Out of the box I had the same issue.

Once I fixed the missing rc.exe problem I had another issue. The linker was missing kernel32.lib.

I corrected both issues by updating the Intel Composer Options (TOOLS->Options...->Intel Composer XE->Visual Fortran->Compilers).

For the Win32 tab I added:

Executables: C:\Program Files (x86)\Windows Kits\8.0\bin\x86; (just before $(PATH))

Libraries: C:\Program Files (x86)\Windows Kits\8.0\Lib\win8\um\x86; (at the end)

For the x64 tab I added:

Executables: C:\Program Files (x86)\Windows Kits\8.0\bin\x64; (just before $(PATH))

Libraries: C:\Program Files (x86)\Windows Kits\8.0\Lib\win8\um\x64; (at the end)

Update...

I was also missing some SDK header files (winver.h and winapifamily.h). I added the following to the same TOOLS->Options... area.

For both the win32 and x64 tabs

Includes: C:\Program Files (x86)\Windows Kits\8.0\Include\um;C:\Program Files (x86)\Windows Kits\8.0\Include\shared;

查看更多
相关推荐>>
6楼-- · 2019-01-03 09:31

If you really need to use the SDK Windows 10 with Visual Studio 2015, you have to download an older version on sdk-archive. Newer version of the SDK changed the place of the rc executable and MSBuild of Visual Studio 2015 update 3 (latest version) can't locate it. At least the version 10.0.14393.795 of the SDK Windows is still compatible with Visual Studio 2015.

查看更多
登录 后发表回答