C++ 1> 项目:错误 PRJ0003:生成“rc.exe”时出错

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2705459/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-28 00:24:52  来源:igfitidea点击:

1>Project : error PRJ0003 : Error spawning 'rc.exe'

c++visual-c++fatal-error

提问by user320950

1>Project : error PRJ0003 : Error spawning 'rc.exe'.. this is the error i get when i try to run this small practice program of reading and writing files which i cant do because of the reason of me not being able to get the files to open correctly. i use microsoft visual c++ 2008 and i have used the file path to try to open the file as well and i cant can someone help?

1>项目:错误PRJ0003:生成'rc.exe'时出错..这是我尝试运行这个读写文件的小练习程序时遇到的错误,由于我无法执行,我无法执行该程序让文件正确打开。我使用 microsoft visual c++ 2008 并且我也使用文件路径尝试打开文件,但我不能有人帮忙吗?

#include <iostream>
#include <fstream>
using namespace std;

int main ()
{
  ifstream infile;  
  ofstream myfile;
  int num;
  infile.open("example.txt");
    if(infile.fail())
    {
        cout << "error" << endl;
    }
  myfile.open ("example.txt");
    if(infile.fail())
        {
            cout << "error" << endl;
        }
  while(!infile.eof())
      {
          example >> num;
      }
  while(!myfile.eof())
      {
          example << num;
      }
  infile.close();
  myfile.close();
  return 0;
}

采纳答案by Hans Passant

There's something wrong with your setup of Visual Studio, it should never have any trouble finding and running rc.exe. First thing to check if the file is there. It should be located in c:\program files\microsoft sdks\windows\v6.0a\bin\rc.exe.

您的 Visual Studio 设置有问题,查找和运行 rc.exe 应该不会有任何问题。首先检查文件是否存在。它应该位于 c:\program files\microsoft sdks\windows\v6.0a\bin\rc.exe。

Next thing to check is that the paths are set properly. Tools + Options, Projects and Solutions, C++ Directories. Upper right: Show directories for = Executable files. Verify that $(WindowsSdkDirs)\bin is listed there. Try adding the folder name explicitly. If the latter step works then your registry is messed up. Despair a bit, rerun Setup.exe and choose Repair.

接下来要检查的是路径设置是否正确。工具 + 选项、项目和解决方案、C++ 目录。右上角:显示 = 可执行文件的目录。验证 $(WindowsSdkDirs)\bin 是否在此处列出。尝试明确添加文件夹名称。如果后一步有效,那么您的注册表就搞砸了。有点绝望,重新运行 Setup.exe 并选择修复。

回答by Robino

The cause of the infamous: Error spawning 'rc.exe'

臭名昭著的原因:错误产生'rc.exe'

  • You freshly installed Visual Studio 2008 (VS2008)
  • Then dutifully patch with Service Pack 1 (SP1)
  • And find that VS environment variables are screwed up, like $(WindowsSdkDirs).
  • 您刚刚安装了 Visual Studio 2008 (VS2008)
  • 然后尽职尽责地修补 Service Pack 1 (SP1)
  • 并发现VS环境变量搞砸了,比如$(WindowsSdkDirs)。

This happens when the service pack doesn't correctly tell the registry where to find the install directory. To fix this:

当服务包没有正确告诉注册表在哪里可以找到安装目录时,就会发生这种情况。要解决此问题:

  • Close Visual Studio 2008
  • Start > Run > Regedit
  • Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows
  • Add new string value called CurrentInstallFolder(if it's not there already)
  • Give this key the value C:\Program Files\Microsoft SDKs\Windows\v6.0A\(or wherever you installed it to)
  • 关闭 Visual Studio 2008
  • 开始>运行>注册
  • 导航到HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows
  • 添加名为CurrentInstallFolder 的新字符串值(如果它还没有)
  • 给这个键值C:\Program Files\Microsoft SDKs\Windows\v6.0A\(或你安装它的任何地方)

When you restart VS2008, you ought to be able compile your program properly.

当你重新启动 VS2008 时,你应该能够正确编译你的程序。

回答by Ricky Lung

Make sure one of the "Executable files" directories (editable via Tools->Options->VC++ Directories) contain both the RC.exe and RcDll.Dll.

确保“可执行文件”目录之一(可通过工具->选项->VC++ 目录编辑)包含 RC.exe 和 RcDll.Dll。

The required RC.exe will most likely placed in "C:\Program Files\Microsoft SDKs\Windows\XXX\Bin" where XXX is the different version number.

所需的 RC.exe 很可能会放在“C:\Program Files\Microsoft SDKs\Windows\XXX\Bin”中,其中 XXX 是不同的版本号。

If a particular version of Microsoft SDK didn't contain RC.exe, you might download the latest one from Microsoft and point the "Executable files" directly to the new directory, try to not use $(WindowsSdkDir) macro since it might still point to the old sdk directory.

如果特定版本的 Microsoft SDK 不包含 RC.exe,您可以从 Microsoft 下载最新版本并将“可执行文件”直接指向新目录,尽量不要使用 $(WindowsSdkDir) 宏,因为它可能仍然指向到旧的sdk目录。

回答by dhony

Maybe your rc.exe is missing in this path:

也许您的 rc.exe 在此路径中丢失:

c:\program files\microsoft sdks\windows\v6.0a\bin\rc.exe

If this is your problem you can copy this application from your friend's computer. hehe,..

如果这是您的问题,您可以从您朋友的计算机上复制此应用程序。呵呵,..

回答by Indi

I realize this is old, but I fixed the same error by checking the "tools" option when installing the Windows SDK. This is selected by default, I had removed it assuming Visual Studio's tools will be used.

我意识到这是旧的,但我通过在安装 Windows SDK 时检查“工具”选项来修复相同的错误。这是默认选中的,假设将使用 Visual Studio 的工具,我已将其删除。

(Using Windows SDK 7.1)

(使用 Windows SDK 7.1)

回答by Elmue

There is nothing to do in the Registry, nor in the Visual Studio settings! You find a LOT of misleading and wrong answers to this question!

在注册表和 Visual Studio 设置中都没有什么可做的!你会发现这个问题有很多误导性和错误的答案!

A detailed explanation of the problem can be found on the link below. The missing files can be downloaded there, too.

可以在下面的链接中找到问题的详细说明。丢失的文件也可以在那里下载。

http://netcult.ch/elmue/Error_spawning_rc.exe.htm

http://netcult.ch/elmue/Error_spawning_rc.exe.htm

回答by jcxz100

I had this case too.

我也遇到过这种情况。

From reading the answer by Elmue (elsewhere on this page) I found out it was caused by me having installed VS2008 + VS2010 + SDK then uninstalling all and deleting some folders manually. After reinstalling VS2008 and SDK in a nonstandard folder the RC.EXE file simply wasn't there, something got mixed up in the installation where some of the registry entries pointed to the SDK default folder (instead of the nonstandard one I used). Correcting the registry entries didn't work. Upon running Repairinstallation of SDK it just "corrected" the entries to point in the wrong direction again, but RC.EXE still didn't install.

通过阅读 Elmue 的答案(本页的其他地方),我发现这是因为我安装了 VS2008 + VS2010 + SDK,然后手动卸载了所有文件夹并删除了一些文件夹。在非标准文件夹中重新安装 VS2008 和 SDK 后,RC.EXE 文件根本不存在,安装中出现了一些问题,其中一些注册表项指向 SDK 默认文件夹(而不是我使用的非标准文件夹)。更正注册表项不起作用。在运行SDK 的修复安装时,它只是“更正”了条目以再次指向错误的方向,但 RC.EXE 仍然没有安装。

In the end I had to bite the bitter apple: uninstalled everything and reinstalled SDK + VS2008 in their standard folders. Then it worked!

最后我不得不咬咬牙:卸载了所有东西,然后在他们的标准文件夹中重新安装了 SDK + VS2008。然后它起作用了!