Microsoft Visual C++ 2008 Express Edition Tutorial

First, download the windows installer from Microsoft/Express and then, run the executable. Follow the instructions and install the program. The following screenshots will help you install the product:

Welcome Screen
Click the Next button to continue

License Terms
Select the "I have read and accept the license terms" option and then, click the Next button to continue

Destionation Folder
Click the Install button to start the installation

Download and Install
Wait for the download and install operations to finish

Setup Complete
Click the Exit button to finalize the installation



You can choose to use the command line tools or the graphical user interface to write your programs. To use the command line tools, check this page on MSDN.

If you would like to use command line tools, we recommend Notepad++ as an editor. It has syntax high-lighting capability, which is very helpful for developers.

If you do not prefer to use command line tools, you can run the Visual Studio IDE by following these instructions:

Start Page
You should see a page similar to this after you run the program

File Menu
Click on the File menu, select New menu item and click on the Project menu item to create a new project

New Project
On the left, choose Win32 under Project types -> Visual C++
And, on the right, choose, "Win32 Console Application" under Templates
Give a name to your project, for instance, "HelloWorld" and click OK to create your project

Win32 Application Wizard - Welcome
Click the Next button to continue

Win32 Application Wizard - Application Settings
Make sure "Console Application" and "Empty Project" options are selected
Click the Finish button to finalize

Add New Item Menu
Right click on the name of the project, for this case, it is "HelloWorld", and select Add menu
Then, click on the New Item menu

Add New Item
On the left, choose Code under Categories -> Visual C++
And, on the right, choose, "C++ File (.cpp)" under Templates
Give a name to your file, for instance, "hello.c" and click the Add button to create your file

Hello World
Now, you can write your code using the editor
Write a simple C program as given in the screenshot

Build Menu
Click on the Build Solution menu item under the Build menu or just press F7
You should be able to see the progress on the Output window below

Build Successful
Assuming you did not make any typing errors on the previous step, you should see a similar output on the Output window

Compile failed
If you try to compile a code which has syntax errors, Output window gives a message similar to this: "0 succeeded, 1 failed..."
In addition, you should be able to see the problems from the Error List Window, which can be opened from View Menu. Select Other Window sub-menu and click on the Error List menu item.

Compile Errors
You can see the errors in the code in the Error list window

Compile Warnings
You can also see the warnings in the Error list window

Running
You can run your program from the Debug menu. Click on the "Start Without Debugging" menu item or press Ctrl+F5

Run Output
After clicking on the "Start Without Debugging" menu item, you should see your program run in a separate window.


Above steps are the necessary steps in order to compile and run C/C++ programs with Microsoft Visual C++.

However, since C++ is a super-set of C, Visual C++ compiles your code as a C++ code. Therefore, you should make sure that your code is a valid C code.

If you prefer to use command line tools, check this page to compile your code according to ANSI C standards.

Otherwise, Visual C++ compiler settings can be configured by following the below two steps:

Project Properties Menu
Right click on the name of the project, for this case, it is "HelloWorld", and click the Properties menu item

Property Pages
On the left, select Language under C/C++ under "Configuration Properties"
On the right, select "Yes (/Za)" for "Disable Language Extensions"
Click the Apply button

Property Pages
On the left, select Advanced under C/C++ under "Configuration Properties"
On the right, select "Compile as C Code (/TC)" for "Compile As"
Click the OK button to finish