I am a biginner C++ programer. I wrote following simple Hello World Application. I have MS visual studio 2005. When I build the project I get following error. Can some help.
*********************************
#include <iostream>
using namespace std;
int main()
{
std::cout << " Hello World! \n";
return(0);
}
******************************
1>Project : error PRJ0050: Failed to register output. Please try to register the component from a command prompt with elevated permissions.
#include <iostream>
using std::cout;
int main()
{
cout << "Hello World!";
return 0;
}
Personally I have never used the "using namespace std;" line, not really sure what it is. And in -your- code it should just be "cout" instead of "std::cout" I think. It may be different since you're including your using statement differently than I do.
His program is as correct as yours. (He also remembered to put a newline at the end of the output.)
I suspect that you compiled it as a "Win32 application" instead of a "Console application".
Create a new project, making sure it is for a console application, then paste your code in and compile.
Open a command prompt, change to the correct directory, and run the program to see it work.
For example, if my project were in D:\prog\foo, go to Start --> Run... and type "cmd.exe", then type
D:
cd \prog\foo
dir /s *.exe
The "dir" command tells you where your program is. If it says something like:
Directory of D:\prog\foo\release
Yeah, I compiled mine earlier, and by adding a new line the program would automatically shut down, so I took it out. But I've never seen C++ code written like his, I'm just in an introductory class. The most complex thing I've written is a topic in this beginner forum for rolling dice. It's not the longest program I've written, but the most advanced. Haha.