visual studio C++ error

  • Thread starter Thread starter Ctiger
  • Start date Start date
Joined
5/5/11
Messages
8
Points
13
Hey guys I am new to C++. When I tried to compile a simple program it gave me the following message:

"Unable to run the program. The system can not find the file specified. "

Can some tell me how to fix this? Thanks.
 
First, tell us what type of application you are executing...(console app, windows forms, etc.) and tell how you wrote the code or how you compile it...We could certainly help.
make sure you have referenced the form you want to appear first in the program.cs class (if you are loading a windows forms application and have deleted the original form1. If not, then be more specific)
 
Its a Win32 Console Application. I am trying to write the "Hello World" as follows:

#include <iostream>
#include <stdafx.h>
int main ()
{
using namespace std;
cout << "Hello World!!;
return 0;
}

When I compile it using the debug sign at the top, I get the error I mentioned above. Thanks.
 
Simply move "using namespace std;" outside of the main() method below #include <stdafx.h>
 
Its a Win32 Console Application. I am trying to write the "Hello World" as follows:

#include <iostream>
#include <stdafx.h>
int main ()
{
using namespace std;
cout << "Hello World!!;
return 0;
}

When I compile it using the debug sign at the top, I get the error I mentioned above. Thanks.

2 things

1) you are missing quotes in your cout
2) try without second include line
 
@Tsotne: I tried but it still didn't work.

@ iniesta: It doesn't work without the second include as well. I am still getting the same error.
 
Really? I just downloaded C++ from Microsoft website, not sure whats the problem.
 
There might be some modification to default settings preventing the direct debug of a program.
 
I don't know what your problem is but I have a high degree of certainty that "stdafx.h" has to do with it. This is not C++ standard so you might as well never use it.

IMHO, you should always start a project from an empty project. There is a way to specify that when you are creating a new project (it's not the default). Then, your program should work.
 
Hey guys I am new to C++. When I tried to compile a simple program it gave me the following message:

"Unable to run the program. The system can not find the file specified. "

Can some tell me how to fix this? Thanks.

Here is a video on creating a VS project and running it. The demo encapulates and resolves some of the usual teething problems.

http://www.datasim.nl/Education/Videos/MyFirstProject/

EVERYONE has these 'issues' in the beginning :cool:
 
Back
Top Bottom