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

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

问题描述

我正在尝试在 Visual Studio 中为 64 位平台编译一个简单的程序.在尝试编译时,我收到错误消息:链接:致命错误 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)VCin 中,而是驻留在 $(VSInstallDir)VCinx86_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)VCin but in the $(VSInstallDir)VCinx86_amd64 folder.

因此,我的问题的解决方案是将 rc.exe 和 rcdll.dll 从 C:Program Files (x86)Windows Kits8.1inx86 文件夹复制到 $(VSInstallDir)VCinx86_amd64 文件夹.

Thus, the solution to my problem was to copy rc.exe and rcdll.dll from the C:Program Files (x86)Windows Kits8.1inx86 folder to the $(VSInstallDir)VCinx86_amd64 folder.

这样做克服了第一个错误.

Doing that overcame that first error.

但是,在构建时,弹出一个新错误:LNK1158:无法运行cvtres.exe".与我的第一个 rc.exe 错误相反,这个文件实际上已经驻留在 $(VSInstallDir)VCin 文件夹中.问题是交叉编译器正在自己的目录中寻找它.所以我只是将该文件从 $(VSInstallDir)VCin 文件夹复制到 $(VSInstallDir)VCinx86_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)VCin 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)VCin folder to the $(VSInstallDir)VCinx86_amd64 folder.

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

Once I did that, my project built and ran.

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

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