How to Install Visual C++ 2010 Express

01
of 02

Installing Visual C++ 2010 Express

Visual C++ 2010 Express Successfully Installed

Microsoft Visual C++ 2010 Express is an excellent development system comprising IDE, Editor, Debugger and C/C++ compiler. Best of all is that it's free. You will have to register your copy after 30 days but it's still free. Giving Microsoft your email address is a pretty good deal and they don't spam you.

Start at the Express Page then click the first link where it says "Get free Visual Studio Express products >"

This will take you to a page where you get the choice of various Visual Development systems all free (Basic, C#, Windows Phone, Web and C++) or an all-in-one. Your choice, but the instructions here are for Visual C++ 2010 Express.

As these tools are .NET based, for example the IDE is based on WPF you will have to install .NET 4 unless you already have it. If you are installing several tools like Visual C# 2010 Express, Visual C++ 2010 Express etc then you'll have to install the prerequisites just for the first one and the remainder will be much much quicker to install.

These instructions assume you are just installing Visual C++ 2010 Express so click the link for that and on the next page click the install Now button on the right of the page. This will download a small exe called vc_web. For this install you will need a reasonable speed internet connection.

Installing

After approving it (on Windows 7/Vista) but probably not on Windows XP SP 3, it will take you through a series of dialogs, with a License Terms to agree, and then show you the location where it will be installed which you cannot change. The download for my system was 68MB but then I already had installed Visual C# 2010 Express and it will occupy about 652MB on your C: drive. After that it takes a few minutes to download and then install. Long enough to make and drink a coffee, especially the installation bit!

If it's successful then you'll see the above screen. Now it's time to try it out with the traditional Hello World, on the next step. Note you may be asked to download Service Pack 1 For Visual Studio and a download link is provided. It's under 1MB in size and you should do this. This will also do a fair bit of downloading, so time for another coffee!

02
of 02

Creating the first project with Visual C++ 2010 Express

Visual C++ 2010 Express Hello World

With Visual C++ open, click File - New - Project then select Win32 on the left and Win32 Console Application on the right. Browse to (or create) an empty folder and give the project a name like helloworld. A popup Window will appear and you should click Application Settings on the left and untick Precompiled Header then click finish.

A project will open, and as personally I'm not a fan of stdafx.h for simple C/C++ programs do the following steps.

  • Select all Header files in the Solution Explorer. If you can't see it, click View on the top menu bar then Solution Explorer. On the screenshot above it's the tree on the left. Now right click on those selected files (there should be two stdafx.h and targetver.h), then click Remove. You will get a choice: you can delete or just remove as you wish. We won't need them in either case.
  • Do the same for Stdafx.cpp.
  • In the editor remove the line #include "stdafx.h"
  • Edit the program so it looks like this, for the C version right click on helloworld.cpp and click rename, then change it to helloworld.c

C Version

 

// helloworld.c
//
#include

int main(int argc, char * argv[])
{
  printf("Hello World") ;
  return 0;
}

 

  • Interested in C Tutorials?

C++ Version


// helloworld.cpp : Defines the entry point for the console application.
//
#include

int main(int argc, char * argv[])
{
  std::cout << "Hello World" << std::endl;
  return 0;
}

 

In either case, press F7 to build it. Now click on the return 0; line, press F9 to get a break point ( a red circle to the left of the green bar will appear) and press F5 to run it. You will see a console Window open with Hello World and it will stop executing on the return libe. Click the Edit Window again and press F5 to have it finish and return to editing mode.

 

Success

You've now installed, edited and built/run your first C or C++ program... Now you can go onto using this or CC386 and follow the C or C++ Tutorials.