Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I just installed Visual Studio 2013 on Windows 10 and I run a code with "Hello World!" and I've got the next message:
The program has exited with code 0 (0x0).
Can anyone help me with this message in Visual Studio 2013 ?

What I have tried:

I've search on the internet but is not working.
Posted
Updated 28-Oct-18 22:02pm
Comments
KarstenK 29-Oct-18 2:20am    
Zero means "no error". So it works fine. When you like another number than set it as return value of the main function. ;-)

If that is what your app gave you when you ran it, that's not an error: zero indicates a successful program termination. Non zero is an error code.

If it doesn't do what else you wanted, then there are 2 possibilities:
1) You didn't code it right. We can't help you fix this without seeing the code you actually wrote, compiled, and executed!
2) It did exactly what you expected, but your computer is too fast. If your code was this:
C#
static void main()
   {
   Console.WriteLine("Hello world");
   }
Then the program could well open the console window, print the message, exit the app, and close the console window before you even noticed it was open...
Try adding this line before the closing curly bracket of the main method:
C#
Console.ReadLine();
And it will stop until you press ENTER before it exits.
 
Share this answer
 
As matter of fact your code exits and you have no chance to see its output.
In order to see the output you might pause the execution, for instance making your program wait for user input, e.g.
C++
#include <iostream>
using namespace std;

int main()
{
	cout << "\n Hello world!" << endl;
    cin.get();
	return 0;
}
 
Share this answer
 
First: The code was written in C++ and is written right.

C++
#include <iostream>
using namespace std;

int main()
{
	cout << "\n Hello world!" << endl;
	return 0;
}


And second, like I said when I compile the code I get:
The program has exited with code 0 (0x0).,
and the console windows doesn't print the message.
 
Share this answer
 
Comments
Richard MacCutchan 28-Oct-18 17:44pm    
Yes, because it is likely that you are running the code in Visual Studio, so the message gets displayed and the console window immediately closes because that is the end of the program. And the last statement in your program returns the value zero to the shell. So it is working as coded.
Richard Deeming 30-Oct-18 12:10pm    
If you want to reply to a solution, click the "Have a Question or Comment?" button under that solution. DO NOT post your reply as a new "solution".

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900