The best way to organize a simple C ++ program is to download Microsoft Visual Studio.
There are 3 different editions:
- Community Edition
- Professional Editon
- Enterprise Edition
The Community Edition is free for individual developers. You can also find a precise comparison on the Microsoft website.
Step 1:
Click to menue “File->New->Project”
Step 2:
Choose “Win32 Console Application”.
Step 3:
Enter any name for your application
Step 4:
Click on “OK” and in then click on “Finish”.
Step 5:
A window with the source code opens.
Step 6:
Add “printf(“Hello World\n”) before return.
// HelloWorld.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
int main()
{
printf("Hello world\n");
return 0;
}
Step 7:
Combile your application by clicking menu “Build -> Rebuild Solution”.
You will now see that two new files have been created:
- HelloWorld.exe
- HelloWorld.pdb
The file with the extension “Exe” is your executeable file.
The file with the extension”pdb” is a “Programm Database” and is used if you want to debug your application.
Step 8:
Open command line “cmd” in windows.
Optionaly you can add a developer command prompt in Microsoft Visual Studion.
Step 9:
Now start your first “Hello World” program in C ++ by simply cut and past the path from the log file above.
After “Enter” your program will now be executed.