Failed to register output

Hi,

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.


KP

As far as I can tell it should be...

1
2
3
4
5
6
7
8
9
10
#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

04/11/2009 03:12 PM 865,848 myproject.exe
1 File(s) 865,848 bytes

then you will also want to change to that directory.

cd release

After that you can run your program by typing its name:

myproject

Hope this helps.
Last edited on
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.
Thanks a lot for the feedback.

I figured it out. While creating new project in MS studio, I chose Customize Wizard (default) which saved the project with lots of declarations.

Later, I created project with Empty project template and it worked fine.

regards,
KP.
Topic archived. No new replies allowed.