Step 1- Starting VC++
Double-click on the Microsoft Visual
C++ icon on the the start menu to launch Microsoft Visual Studio. It
will come up as an empty window.
Step 2- Create a Project
When programming in Visual C++ you
must use a project so that all the necessary files can be linked together
properly. Select 'File>New' from the menu. The 'New'
dialog box will appear.

Follow these steps.
1. Select the 'Projects'
tab.
2. From the list at the left, select
'Win32 Console Application.'
3. In the 'Location'
text box, type the name of the folder you wish to create your project
in.
4. Type in a name for the project
in the textbox "Project Name". You will notice
as you type that the project's name is added onto the end of the folder
in the 'Location' text box. All your project files will
be placed inside this subfolder.
Now select OK
to create your project. If you are using version 6 of the development
environment, a dialog box will appear asking what type of application
you wish, in that case answer 'An empty project' and click
'Finish'.
Step
3 - Creating your source file |
|
At
this point you shall have an empty project.
On the left side there should now be two tabs 'Classview'
and 'FileView' to the leftmost window.
Click on the 'FileView' tab.
In 'FileView'
you should be able to see a group icon called 'HelloWorld
Files'.
At present all the different folders
will be empty because you haven't created any files to go in your
project yet.
You will
need to add a source code file next so you can type
in some code. |
Select 'File>New'
from the menu. The 'New' dialog box will appear again.

Follow these steps.
1. Make sure the the 'Files'
tab is selected.
2. From the list at the left, select
'C++ Source File.'
3. Tick the 'Add to Project'
checkbox.
4. Type in a name for your source
file. I would suggest the name 'HelloWorldSource.'
5. In the 'Location'
text box, Make sure the name of your project folder is displayed.
Step 4 - Type in the Program
Now type in the code for your 'HelloWorld'
program as shown below.
|
#include
<iostream.h>
int main()
{
cout << "Hello World!\n";
return 0;
} |
Step
5 - Compile, link and run |
|
To
compile and link the program, select 'Build > Build HelloWorld.exe'
from the menu.
You may then run the program by selecting 'Build
> Execute HelloWorld.exe'
If your code is incorrect then errors and warnings
may be displayed in the bottom frame.
If this is the case, then re-check all your code
and ensure all the curly brackets and semicolons are in the right
place. Try again.
If you still get errors then go to the next section
on compiler errors. |
If all goes well a Command Prompt Console windows
should appear with the words:-
Hello World!
...written to the screen. If so then 'Well Done!'
you have just successfully written your first program. |

|