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

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

问题描述

我刚刚安装了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 的内容无关。)

在VS2015 x64本机命令提示符下进行CMake调用:

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.0\VC\bin\x86_amd64\CL.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"Debug\vc140.pdb" /Gd /TC /errorReport:queue CMakeCCompilerId.c
  CMakeCCompilerId.c
Link:
  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\link.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 Debug\CMakeCCompilerId.obj
LINK : fatal error LNK1158: cannot run 'rc.exe' [D:\dev\cmaketest\build\CMakeFiles\3.8.1\CompilerIdC\CompilerIdC.vcxproj]

<$ c $找不到c> 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 Kits\8.1\bin\x64\rc.exe
C:\Program Files (x86)\Windows Kits\8.1\bin\x86\rc.exe

和VS 2017命令提示:

and a VS 2017 command prompt:

> where rc.exe
C:\Program Files (x86)\Windows Kits\10\bin\10.0.15063.0\x64\rc.exe

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

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


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

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


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

    C:\Program Files (x86)\Windows Kits\10\bin\x64
    C:\Program Files (x86)\Windows Kits\10\bin\10.0.15063.0\x64
    


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

    C:\Program Files (x86)\Windows Kits\10\bin\x64
    

    其中不包含 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?


  • 编辑:已安装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.0\VC\bin\amd64\vcvars64.bat
    

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

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

    C:\Program Files (x86)\Windows Kits\10\bin\x64
    

    到PATH。这是 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 Kits\10\bin\10.0.15063.0\x64
    

    我回过头来,觉得这是一个设置问题,我重新运行了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 App开发工具->工具(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 Kits\10\bin\x64
    

    rc -v 上运行

    C:\Program Files (x86)\Windows Kits\10\bin\10.0.15063.0\x64\rc.exe
    

    C:\Program Files (x86)\Windows Kits\10\bin\x64\rc.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 Kits\10\bin\x64\rc.exe
    

    应该是默认的 rc.exe ,但是不能通过上一次安装进行设置。

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

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

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