Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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())
      {
          example << num;
      }
  infile.close();
  myfile.close();
  return 0;
}
like image 635
user320950 Avatar asked Apr 24 '10 17:04

user320950


1 Answers

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.

like image 60
Robino Avatar answered Sep 20 '22 00:09

Robino