错误 LINK : fatal error LNK1158: 没法运行“rc.exe”

问题 软件环境:Windows 10 Pro + Visual Studio 2015 而后安装了 Windows 10 SDK Windows 10 SDK 是用这个 ISO 文件安装的:17134.12.180419-0858.rs4_release_svc_prod2_WindowsSDK.isonode

在 Visual C++ 工程中,我将 Target platform 从 8.1 切换到 10.0.17134.0:ui

而后就发现本来编译正常的 C++ 工程如今编译出错了。在 link 的时候,出现如下错误:prototype

1>—— Build started: Project: PHM-Hnode-Std-GuiLauncher, Configuration: Debug x64 —— 1> MainFrameBaseClass.cpp 1> MainFrame.cpp 1> main.cpp 1> Generating Code… 1>LINK : fatal error LNK1158: cannot run ‘rc.exe’ ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========orm

调查 因为之前在 Target Platform Version 设置为 8.1 的时候编译是正常的,因此我猜测,是否是这个 rc.exe 在 8.1 版本的 SDK 中存在,但在 10.0.17134.0 版本的 SDK 中被遗漏了。ip

果真在 8.1 版本的 SDK 中发现了 rc.exe,与此同时还看到了一个 rcdll.dll。get

目录:it

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

Windows 10 SDK 的目录结构和 Windows 8.1 SDK 的目录结构有所不一样:编译

在 10.0.17134.0 的目录下发现 rc.exe 和 rcdll.dll 是存在的:form

因此说,rc.exe 和 rcdll.dll 文件并不缺失,只是编译的时候链接器没有找到它们。

解决 我也不知道如何让连接器找到这两个文件,且找到正确的版本。因此我把

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

这个目录下的 rc.exe 和 rcdll.dll 拷贝到个人 Visual C++ 的 VC/Bin 目录下:

D:\Apps\x86\Microsoft\Visual_Studio\v14.0\VC\bin

注意个人 Visual C++ 的安装目录可能和你的不一样,你须要用你本身的的 VC/Bin 目录。

而后再编译程序,错误解决了:

1>—— Rebuild All started: Project: PHM-Hnode-Std-GuiLauncher, Configuration: Debug x64 —— 1> MainFrameBaseClass.cpp 1> MainFrame.cpp 1> main.cpp 1> Generating Code… 1> PHM-Hnode-Std-GuiLauncher.vcxproj -> D:\DevSpace\Gitpub\phm-prototype-180601\Dev\Build\MSVC_2015\Win32\Output\x64\Debug\PHM-Hnode-Std-GuiLauncher.exe 1> PHM-Hnode-Std-GuiLauncher.vcxproj -> D:\DevSpace\Gitpub\phm-prototype-180601\Dev\Build\MSVC_2015\Win32\Output\x64\Debug\PHM-Hnode-Std-GuiLauncher.pdb (Partial PDB) ========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========

相关文章
相关标签/搜索