C++ Program

C++ Hello World Compiling

Compiling C++ Hello World program example with Dev-C++ is quite simple. Here is a step by step tutorial how to do it. Let’s start devcppPortable.exe and choose from the top menu File > New > Project. Then we get a window with settings for our new project. The window looks like this:

 C++ Hello World compiling – image loading

We need to make some changes to force Dev-C++ create for us a certain type of project. Otherwise we’ll get error messages. It’s 3 changes. We set C++ as default language. C is subset of C++ so we’ll not think much about it now. Then we change Project1 name of our project to some more understandable name. And we click on Windows Application because that’s what we want. Our project settings windows now should look like this:

  After we make sure that everything is correct we press OK and Dev-C++ will ask us where to save our 00-Cpp-Hello-World.dev file. We browse to Project folder and create inside it a folder called 00-Cpp-Hello-World. There we save the .dev file. And immediately after that we’ll see the code window of main.cpp file. It originally contains some sample code. Let’s delete it all and copy in that window our C++ Hello World sample program.

Then a moment of triumph comes. We press in the top menu Execute > Compile. Then if everything was done right we’ll see the resulting window:

 0 Warnings and 0 Errors means that everything worked out right. Warnings do not prevent compilation while errors stop it.

And now we should have a look into Projects > 00-Cpp-Hello-World folder to find there our resulting program called 00-Cpp-Hello-World.exe. We run it and see the spectacular result:

  In fact Avast antivirus sometimes delays a newly created executable file immediate execution for several seconds. Then we have to run it again.

Leave a Reply

Your email address will not be published. Required fields are marked *