开发者

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

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?

#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())
      {
          exa开发者_JS百科mple << num;
      }
  infile.close();
  myfile.close();
  return 0;
}


The cause of the infamous: Error spawning '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).

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)

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


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.

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.


Make sure one of the "Executable files" directories (editable via Tools->Options->VC++ Directories) contain both the RC.exe and 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.

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.


Maybe your rc.exe is missing in this path:

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,..


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.

(Using Windows SDK 7.1)


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!

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


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 Repair installation of SDK it just "corrected" the entries to point in the wrong direction again, but RC.EXE still didn't install.

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜