rc.exe 不再在 VS 2015 命令提示符中找到 [英] rc.exe no longer found in VS 2015 Command Prompt

查看:38
本文介绍了rc.exe 不再在 VS 2015 命令提示符中找到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚安装了 Windows 10 Creators Update(版本 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就清楚失败的原因了:

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.1inx64
c.exe
C:Program Files (x86)Windows Kits8.1inx86
c.exe

还有一个 VS 2017 命令提示符:

and a VS 2017 command prompt:

> where rc.exe
C:Program Files (x86)Windows Kits10in10.0.15063.0x64
c.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.

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

    1. 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.0x64
    c.exe
    

    C:Program Files (x86)Windows Kits10inx64
    c.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 Kits10inx64
    c.exe
    

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

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

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

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