LNK1158无法运行rc.exe x64 Visual Studio [英] LNK1158 cannot run rc.exe x64 Visual Studio

查看:474
本文介绍了LNK1158无法运行rc.exe x64 Visual Studio的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Visual Studio中为64位平台编译一个简单程序。尝试编译时,出现错误:
LINK:致命错误LNK1158:无法运行'rc.exe'

I'm trying to compile a simple program in Visual Studio for a 64-bit platform. Upon trying to compile, I get the error: LINK : fatal error LNK1158: cannot run 'rc.exe'

我去过许多讨论线程,它指示将rc.exe和rcdll.dll从Windows Kits文件夹复制到VC / bin文件夹。我没有成功。在我看来,我的Visual Studio版本可能只是不在我认为正在寻找rc.exe文件的目录中寻找。有没有一种方法可以在Visual Studio中标识正在寻找该可执行文件的目录?

I've been to many discussion threads where it indicates to copy rc.exe and rcdll.dll from the Windows Kits folder to the VC/bin folder. I've done this to no avail. It occurs to me that my version of Visual Studio may just not be looking in the directory I think it's looking for this rc.exe file. Is there a way to identify w/in Visual Studio which directory it's looking for this executable?

(有人建议,这个问题可能是问答的重复。在中提供的无法使用针对x64的VC ++ / VS2010进行编译:LNK1158:无法运行cvtres.exe 。但是,这似乎不是这种情况是因为该路径被系统上运行的某些NV服务破坏了,当我键入echo%PATH%时,我的完整路径显示出来了,所以我没有这个问题。正确的解决方案,如下所示)

(It was suggested that this problem may be a duplicate of the question and answer provided at Cannot compile with VC++/VS2010 targeting x64: LNK1158: cannot run cvtres.exe. However, this does not seem to be the case because, there, the path was getting corrupted by some NV services that were running on the system. I am not having that problem as my full path shows up when I type echo %PATH%. That being said, that link did lead me to the correct solution, given below)

推荐答案

错误的确是我放置rc.exe和rcdll.dll文件的地方。因为我正在编译为64位平台,所以Visual Studio使用的是64位交叉编译器,不是驻留在$(VSInstallDir)\VC\bin中, $(VSInstallDir)\VC\bin\x86_amd64文件夹。

The error was indeed where I was placing the rc.exe and rcdll.dll files. Because I'm compiling to a 64-bit platform, Visual Studio is using the 64-bit 'cross-compiler' which does not reside in the $(VSInstallDir)\VC\bin but in the $(VSInstallDir)\VC\bin\x86_amd64 folder.

因此,解决我的问题的方法是从Windows Server 2003复制rc.exe和rcdll.dll。 C:\Program Files(x86)\Windows Kits\8.1\bin\x86文件夹到$(VSInstallDir)\VC\bin\x86_amd64文件夹。

Thus, the solution to my problem was to copy rc.exe and rcdll.dll from the C:\Program Files (x86)\Windows Kits\8.1\bin\x86 folder to the $(VSInstallDir)\VC\bin\x86_amd64 folder.

这样做可以克服第一个错误。

Doing that overcame that first error.

但是,构建时会弹出一个新错误:LNK1158:无法运行 cvtres.exe。与我的第一个rc.exe错误相反,此文件实际上确实位于$(VSInstallDir)\VC\bin文件夹中。问题是交叉编译器正在其自己的目录中查找它。所以我只是将文件从$(VSInstallDir)\VC\bin文件夹复制到$(VSInstallDir)\VC\bin\x86_amd64文件夹。

However, upon building, a new error popped up: LNK1158: cannot run 'cvtres.exe'. In contrast to my first rc.exe error, this file actually already does reside in the $(VSInstallDir)\VC\bin folder. The problem is that the cross-compiler is looking for it in its own directory. So I just copied that file from the $(VSInstallDir)\VC\bin folder to the $(VSInstallDir)\VC\bin\x86_amd64 folder.

一旦这样做,我的项目就会建立并运行。

Once I did that, my project built and ran.

这篇关于LNK1158无法运行rc.exe x64 Visual Studio的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆