在 VS 2015 命令提示符中不再找到 rc.exe

编程入门 行业动态 更新时间:2024-10-17 02:50:58
本文介绍了在 VS 2015 命令提示符中不再找到 rc.exe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚安装了 Windows 10 创意者更新(版本 10.0.15063).

I just installed Windows 10 Creators Update (version 10.0.15063).

我安装了多个版本的 Visual Studio(2012、2013、2015 和 2017).我几周前才安装了 VS 2017.

I have multiple versions of Visual Studio installed (2012, 2013, 2015 and 2017). I installed VS 2017 only a couple weeks ago.

CMake(3.8.1 版)在VS2015 x64 本机命令提示符"中运行时不再找到 C/C++ 编译器(在 VS 2017 命令提示符中运行时它确实正常工作).

CMake (version 3.8.1) no longer finds the C/C++ compiler when run inside a "VS2015 x64 Native Command Prompt" (it does work properly when run inside a VS 2017 command prompt).

CMakeLists.txt 的内容:

project (test)
add_executable (test test.cpp)

(test.cpp 的内容无关.)

CMake 调用,在 VS2015 x64 本机命令提示符中:

CMake invocation, in a VS2015 x64 Native Command Prompt:

> mkdir build
> cd build
> cmake -G "Visual Studio 14 2015 Win64" ..

CMake 输出:

-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:1 (project):
  No CMAKE_C_COMPILER could be found.

CMake Error at CMakeLists.txt:1 (project):
  No CMAKE_CXX_COMPILER could be found.

-- Configuring incomplete, errors occurred!
See also "D:/dev/cmaketest/build/CMakeFiles/CMakeOutput.log".
See also "D:/dev/cmaketest/build/CMakeFiles/CMakeError.log".

分析

查看CMakeFiles/CMakeError.log就很清楚失败的原因了:

Analysis

The reason of the failure is clear when looking at CMakeFiles/CMakeError.log:

ClCompile:
  C:Program Files (x86)Microsoft Visual Studio 14.0VCinx86_amd64CL.exe /c /nologo /W0 /WX- /Od /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"Debug\" /Fd"Debugvc140.pdb" /Gd /TC /errorReport:queue CMakeCCompilerId.c
  CMakeCCompilerId.c
Link:
  C:Program Files (x86)Microsoft Visual Studio 14.0VCinx86_amd64link.exe /ERRORREPORT:QUEUE /OUT:".CompilerIdC.exe" /INCREMENTAL:NO /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /PDB:".CompilerIdC.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:".CompilerIdC.lib" /MACHINE:X64 DebugCMakeCCompilerId.obj
LINK : fatal error LNK1158: cannot run 'rc.exe' [D:devcmaketestuildCMakeFiles3.8.1CompilerIdCCompilerIdC.vcxproj]

rc.exe(资源编译器)未找到.确实,在同一个 VS 2015 命令提示符下:

rc.exe (Resource Compiler) is not found. Indeed, in the same VS 2015 command prompt:

> where rc.exe
INFO: Could not find files for the given pattern(s).

虽然它在 VS 2013 命令提示符中找到的:

While it is found in a VS 2013 command prompt:

> where rc.exe
C:Program Files (x86)Windows Kits8.1inx64c.exe
C:Program Files (x86)Windows Kits8.1inx86c.exe

和 VS 2017 命令提示符:

and a VS 2017 command prompt:

> where rc.exe
C:Program Files (x86)Windows Kits10in10.0.15063.0x64c.exe

在各种VS命令提示中检查PATH环境变量的内容:

Checking the content of the PATH environment variables in various VS command prompts:

在 VS 2013 命令提示符中,PATH 包含

C:Program Files (x86)Windows Kits8.1inx64

在 VS 2017 命令提示符中,PATH 包含

C:Program Files (x86)Windows Kits10inx64
C:Program Files (x86)Windows Kits10in10.0.15063.0x64

但是在 VS 2015 命令提示符中,PATH 只包含

C:Program Files (x86)Windows Kits10inx64

不包含rc.exe.

这是一个已知问题还是特定于我的系统?

Is this a known issue or is it specific to my system?

Windows 10 Creators Update 可能会在系统中安装、卸载或更改哪些会触发此问题的内容(可能与 Windows SDK 相关)?

What could Windows 10 Creators Update possibly install, uninstall or alter in the system (perhaps something related to Windows SDKs) that would trigger this problem?

有什么干净的方法可以解决这个问题?

What is a clean way to resolve this?

已安装 VS 2017 组件:

Installed VS 2017 components:

推荐答案

花了一些时间在安装了 Win10 Creators Edition 和 VS2010、VS2013、VS2015 和 VS2017 的三台机器上查看这个问题,它在两台机器上工作,但在第三.所有人都安装了 VS2015 Update 3,并且都应该使用相同的选项进行安装.

Spent some time looking at this on three machines with Win10 Creators Edition and VS2010, VS2013, VS2015 and VS2017 installed, where it works on two machines and fails on the third. All had VS2015 Update 3 and all should have been installed with the same options.

运行以下批处理文件

C:Program Files (x86)Microsoft Visual Studio 14.0VCinamd64vcvars64.bat

应该为 VS2015 x64 环境设置正确的环境.这应该添加

should setup the correct environment for VS2015 x64 environment. This should add

C:Program Files (x86)Windows Kits10inx64

到路径.这是 rc.exe 应该在的地方.然而,在我出现故障的机器上 rc.exe 从这里丢失,但它确实存在于

to the PATH. This is where rc.exe should be. However on my failing machine rc.exe was missing from here, but it did exist in

C:Program Files (x86)Windows Kits10in10.0.15063.0x64

我回去后感觉这是一个设置问题,我重新运行了 VS2015 Update 3 设置并告诉它添加

I went back and feeling like this was a setup issue I re-ran the VS2015 Update 3 setup and told it to add

Windows 和 Web 开发 -> 通用 Windows 应用程序开发工具 -> 工具 (1.4.1) 和 Windows 10 SDK (10.0.14393)

这导致 rc.exe 和相关文件出现在

this caused rc.exe and related files to appear in

C:Program Files (x86)Windows Kits10inx64

C:Program Files (x86)Windows Kits10in10.0.15063.0x64c.exe

C:Program Files (x86)Windows Kits10inx64c.exe

给出相同的版本号10.0.10011.16384

不确定为什么原始安装中缺少 rc.exe,但重新运行安装并添加其他 SDK 为我修复了它.看起来像

Not sure why rc.exe was missing from the original install, but re-running the install and adding the other SDK fixed it for me. It looks like

C:Program Files (x86)Windows Kits10inx64c.exe

应该是默认的 rc.exe 但它不是由以前的安装设置的.

should be the default rc.exe but it was not setup by a previous install.

这篇关于在 VS 2015 命令提示符中不再找到 rc.exe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-03-31 04:55:10,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/795894.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:命令提示符   exe   rc

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!