Reputation: 77
I've reinstalled Visual Studio 2010 Professional several times to try to get it to work. I had to uninstall Visual Studio 2012 Professional because it wasn't compiling something we did in class.
I completely uninstalled everything including SQL Server..
I went to VC/include and the iostream header file is not there.
#include <iostream>
int main () {
cout << "hello";
system ("PAUSE");
return 0;
}
This is all I'm trying to do because nothing else is working.
It's really driving me crazy because I need to get it working so that I can do my project!!!
Every time I do; new project => empty project => add an item to source =>.cpp
I'm running windows 8.
It just says Error cannot open source file Also, error cout identifier is undefined....
I'm wondering if I should do a system restore? Or if I should just completely reinstall windows 8 from my recovery media?
Upvotes: 4
Views: 25420
Reputation: 1
if it is problem with visual studio 2012, install this update.
Upvotes: -2
Reputation: 82480
One problem is that you did not include the namespace std
.
This is what your code should look like:
#include <iostream>
using namespace std;
int main (void) {
cout << "hello" << endl;
system("pause");
return 0;
}
or you could have done something like this: std::cout << "Hello" << std::endl;
This may be a problem because you did not set your environment to C++. This is how you do it:
That should do the trick. If it does not, you might consider re-installing Visual C++ itself. For VS 2012. If that does not work, then re-install the program.
Upvotes: 5