programing tip

rc.exe로 인해 Visual Studio를 빌드 할 수 없습니다

itbloger 2020. 7. 26. 12:38
반응형

rc.exe로 인해 Visual Studio를 빌드 할 수 없습니다


온라인에서 검색했는데 내 문제와 유사한 것을 찾을 수 없습니다.

빈 C ++ 프로젝트를 만들고 main.cpp를 반환하고 추가 할 수 없었습니다. 내가받는 메시지는 다음과 같습니다.

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 ==========

VS2012 내에이 실행 파일을 찾을 위치를 지정할 수있는 곳이 있습니까? Windows 7 SDK를 설치했으며 다음에이 실행 파일이 있습니다.

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

Code :: Blocks에서 왔으며 mingw-gcc를 아무런 문제없이 사용했지만 최근에는 관리 구현에 VS가 필요했기 때문에 누군가 아이디어가 있기를 바랍니다.


구글에서이 발견 ... 나는 귀하의 경우 복사 것이라고 생각할 겁니다 rc.exercdll.dllvisual studio 2012\vc\bin어디든지이 설치되어 :

2 부 : 수정 링크 : fatal error LNK1158: cannot run ‘rc.exe’

이것을 PATH 환경 변수에 추가하십시오.

C : \ Program Files (x86) \ Windows 키트 \ 8.0 \ bin \ x86

이 파일들을 복사하십시오 :

rc.exe
rcdll.dll

에서

C : \ Program Files (x86) \ Windows 키트 \ 8.0 \ bin \ x86

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

또는 나는 이것을 발견했다.
마이크로 소프트는 MSVT 패키지에서 몇 가지를 제외했다. 실수로 또는 라이센스 이유로 인해 누락되었는지 여부를 아는 사람이 없기 때문에 MSVC를 가진 사람은이를 포기하는 데 너무 관심이 없습니다. 몇몇 Google 검색은 까다로운 소스를 제공합니다. 다행스럽게도 Microsoft는 마침내이 문제를 해결하고 해결했습니다.

http://msdn.microsoft.com/vstudio/express/support/faq/default.aspx#pricing

http://msdn.microsoft.com/vstudio/express/support/install/

많은 양의 MSVT 누락 파일이 있지만 누락 된 SDK 파일은 없습니다.

그리고 이것은 :
나는 이것을 수행함으로써 해결했던 것과 같은 문제가 있었다.

  1. Microsoft .Net Framework 2.0 설치
  2. 전역 컴파일러 설정> 프로그램> Code :: Blocks 내의 추가 경로에 .NET Framework 파일 ( "C : \ WINDOWS \ Microsoft.NET \ Framework \ v2.0.50727") 경로 추가

이제 오류없이 리소스 파일을 빌드하고 연결할 수 있습니다.


머신에 VS2017을 설치 한 후 CMake / Visual Studio 2015 빌드에서이 문제가 발생했습니다. 우리의 경우 올바른 해결책은 Visual Studio 명령 프롬프트에 Window Kit 버전 (8.1)을 지정하는 것입니다. 그렇지 않으면 bin 디렉토리에 rc.exe를 포함하지 않는 Windows 10 Kit가 기본적으로 표시됩니다.

예 : 시작 메뉴-> Visual Studio 2015-> VS2015 x64 기본 도구 명령 프롬프트

%comspec% /k "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64 8.1

끝에 8.1 옵션을 참고하십시오.


내가 찾은 것에서 Windows 7 OS를 사용하는 경우 다음 단계를 수행하면 문제가 해결됩니다.

1) C : \ Program Files (x86) \ Microsoft SDKs \ Windows \ v7.1A \ Bin으로 이동하십시오.

2) 그런 다음 RC.exe 및 RcDll을이 파일에서 복사하십시오.

3) C : \ Program Files (x86) \ Microsoft Visual Studio 12.0 \ VC \ bin으로 이동하여 복사 한 두 파일을 붙여 넣습니다.

나는 같은 문제가 있었고 위에 게시 된 해결책이 효과가 없었습니다. 내 솔루션은 그것에서 파생되었으며 위의 방법으로 작동하지 않으면 시도해 볼 수 있습니다.


rc.exeVisual C ++ 컴파일러와 Windows 10 SDK 버전이 동일한 Visual Studio 연도에 해당하지 않으면 오류가 발생할 수 있습니다.

Visual Studio 2017이 있고 자체 2015 Windows SDK를 설치하도록 선택하지 않고 Build Tools 2015를 설치 한 경우 (기본 설치는 설치하지 않습니다!)이를 사용하여 컴파일하려고하면이 문제가 발생할 수 있습니다.

In my case, I already had Visual Studio 2017. When I tried to use Build Tools 2015 to compile a python library (or probably any program), this same 'rc.exe' error occurred. I read that the VS2015 14.0 C++ compiler can glitch if it tries to use the Windows 10 SDK from Visual Studio 2017.

I uninstalled Build Tools 2015, and reinstalled it, this time as a custom installation, selecting to install both visual C++ and Windows 10 SDK components. This fixed the issue.


In my case, I had a mix and match error between projects created in VS2015 and VS2017. In my .vcxproj file, there's this section called PropertyGroup Label="Globals">. I had a section for TargetPlatformVersion=10.0.15063.0. When I removed the TargetPlatformVersion, that solved the problem.

Sorry I can't copy and paste the block here, but stackoverflows coding format did not allow that.


I'm on Windows 7 x64 and Visual Studio 2017. I get this error trying to compile a cython script. That's how I solved: 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\x86_amd64

Here is my almost similar case:
I have VC2010 working project under Win7 32bit. I make clean install of VC2013 under Win8.1 64bit After successful converting of my project from VC2010 to VC2013, during 1st compilation the following error rise:
Finished generating code
LINK : fatal error LNK1158: cannot run 'rc.exe'

Solution 1:
Delete whole line “<ExecutablePath Condition=”...”>...</ExecutablePath>” in element “<PropertyGroup>” in NameOfYourSolution.vcxproj file in notepad before to run VC2013
Solution 2:
Copy only two files: rc.exe and rcdll.dll from “c:\Program Files (x86)\Windows Kits\8.1\bin\x86\” to “c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\” and compilation will be successful!!
Note:
a)It is not need to touch any PATH or other Windows or VC environment variables.
b)“Platform Toolset” (Project Property Pages –> Configuration Properties –> General) will be automatic set to “Visual Studio 2013 (v120)” (not change it to “Visual Studio 2010” to be able to continue to develop your project under VC2013 concepts)


In my case the error was due to a bad setting in a vcxproj. The vcxproj was from a third party, so I'm not sure how it got in that state.

Specifically, for one of the platform/profile combos, the platform folder was missing from the Windows SDK bin folder:

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
 <ExecutablePath>$(VCInstallDir)bin\x86_amd64;$(VCInstallDir)bin;$(WindowsSdkDir)bin\NETFX 4.0 Tools;$(WindowsSdkDir)bin\x86;

is correct, where

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
 <ExecutablePath>$(VCInstallDir)bin\x86_amd64;$(VCInstallDir)bin;$(WindowsSdkDir)bin\NETFX 4.0 Tools;$(WindowsSdkDir)bin;

was incorrect. Might need to scroll to the end of the code boxes to see the difference.

Note also, that for some strange reason $(WindowsSdkDir)bin\x64; did NOT work for me. Tried to figure out why, when rc.exe definitely exists in that folder, but I gave up.

In my opinion, the solutions from previous posters that involve copying rc.exe all over the place are wrong, because your project will not work on anyone else's machine. If you fix up the paths in the project correctly, it should work on any machine with a correct installation of the Windows SDK.


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.


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)


I had the same problem on VS 2013 and was able to fix it by changing the Platform Toolset.

You can find it in project settings, general.

E.g. switching Platform Toolset to VS 2010 will cause VS to use the Windows\v7.0A SDK.

You can check which SDK path is used by adding this to your prebuild event:

echo using SDK $(WindowsSdkDir)

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;


I just figured out one (out of the 3 in total) projects in my VS2010 (SDK7.1) solution (projects are linked in a sequential linear dependency chain), had a .rc file in the project files that was empty. Removing the empty .rc file (from the project, without deleting it) solved the "fatal error LNK1158: ... cvtres.exe" problem.

Update: The following copy fixed the problem:

xcopy "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\cvtres.exe" "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\x86_amd64\"

This will enable WinSDK7.1, via MSBuild, to be able to compile .rc files into the executables.


I've encountered this issue recently. I have both VS 2015 and VS 2017 installed, Windows kits 8.1 and 10 installed.

Command prompt from VS 2017 works as expected, rc.exe is visible. In VS 2015 this is not true. Actually, vcvarsall.bat script from VS 2015 does add a path to Windows 10 kit to PATH variable, but it adds a slightly wrong path. It adds path to

"C:\Program Files (x86)\Windows Kits\10\bin\x86"

while the actual path is

"C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x86"

It seems that updating Windows 10 kit (or installing VS 2017) led to this issue.

So the solution is simple: just create symbolic links in "C:\Program Files (x86)\Windows Kits\10\bin" folder pointing to the corresponding folders in the underlying folder, e.g. a symbolic link "x86" for folder "10.0.17763.0\x86", "x64" for "10.0.17763.0\x64" etc.


This can be caused by a vcxproj that originated in previous versions of Visual Studio OR changing the Platform Toolset in Configuration Properties -> General.

If so, possible Solution:

1) Go to Configuration Properties -> VC++ Directories

2) Select drop down for Executable Directories

3) Select "Inherit from parent or Project Defaults"


This is even easier than that with Visual Studio 2017. Follow these instructions: https://docs.microsoft.com/en-us/visualstudio/install/modify-visual-studio to modify using Microsoft Visual Studio Installer.

Once inside the Microsoft Visual Studio Installer, click modify under your installed Visual Studio package, make sure the Desktop development with C++ is checked, and the MFC and ATl support (x86 and x64), under summary.


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


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.


Maybe project file was touched by VS2017. Then when you link the project in 2015 "LINK : fatal error LNK1158: cannot run 'rc.exe'" can brake the build.

In vcxproj try to:

1) replace:

<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion> with: <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>

2) remove: <VCProjectVersion>15.0</VCProjectVersion>

3) replace: <PlatformToolset>v141</PlatformToolset> with: <PlatformToolset>v140</PlatformToolset>


In my case, I installed the Windows SDK 10586 via Visual Studio 2015 -> Modify, then the following paths are installed.

C:\Program Files (x86)\Windows Kits\10\bin\arm64\rc.exe

C:\Program Files (x86)\Windows Kits\10\bin\x64\rc.exe

C:\Program Files (x86)\Windows Kits\10\bin\x86\rc.exe


For Visual Studio Community 2019, copying the files in the answers above (rc.exe rcdll.dll) to C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.21.27702\bin\Hostx86\x86 did the trick for me.

참고URL : https://stackoverflow.com/questions/14372706/visual-studio-cant-build-due-to-rc-exe

반응형