noobtuts

C++ Tutorial for noobs - Part 1: Installation

...Back to Part 0: Introduction

Before we can use C++, we will have to install it somehow. This tutorial explains how to install Microsoft's Visual Studio 2008 under Windows and how to create a new C++ project. If you are using a Mac, you may try XCode. If you work on linux, try Eclipse CDT.

We will use the Visual Studio 2008 Express version.

If the link doesn't work anymore, just Google for "Visual Studio 2008 Express Download". Newer versions might work too, however older versions would require a lot of complicated setup so 2008 is the way to go.

Once installed, we open Visual Studio and select File->New->Project from the top menu:
visual-studio-2008-started

Now we select Win32 as Project type and then Win32 Console Application as Template. The last step is to enter a project name and the location where it should be saved:
visual-studio-2008-new-project

After pressing OK a new window appears where we press Finish. Our project was now created and we see the following source code:

// test.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"


int _tmain(int argc, _TCHAR* argv[])
{
    return 0;
}

A short explanation about what the program does so far:

We can run it by pressing the green button at the top:
visual-studio-2008-run

If Visual Studio says that the 'project is out of date' and asks if we want to build it, we select 'Yes' and 'Do not show this dialog again'.

Visual Studio then compiles our project and runs it, which results in the black console window showing up and then closing itself immediately afterwards - which is normal because our program doesn't really do anything yet.

On a side note: it's recommended to click on View -> Other Windows -> Error List once so if we get any errors, we can also see what and where they are. Which is... pretty useful.

Continue to Part 2: Output...