How to Set Up a Project when using Visual C++ 2005 Express Edition
(3 December 2006)

Before you try to set up a project, you must have installed Microsoft Visual C++ Express Edition on your computer. If the installation is successful, you will see a Microsoft Visual C++ 2005 Express Edition icon on your desktop. To download Microsoft Visual C++ 2005 Express Edition, go to the Microsoft download site, and follow the directions there.

Initial Steps

1. Start Visual C++ 2005 Express Edition by double-clicking on the desktop icon. You should see this:

Note the list headed Recent Projects. If you are returning to a project you were working on earlier, just click on the project name to load it.

2. To create a new project, click Create: Project…. You should see the New Project window:

In this screen, to the following:

The Location: field will look similar to what you see in the above screen shot, except that "Jack" will be replaced by your user-name on the computer you are using.

CAUTION: Make absolutely certain that General and Empty Project are selected. Nothing will work right if you make a mistake here.

3. Now click OK. You will see this screen:

When you clicked OK, a project was created as a folder in My Documents\Visual Studio 2005\Projects. In this example, the project folder is named My Documents\Visual Studio 2005\Projects\Project 13. Visual C++ Express Edition places several project-related files in this folder. You do not need to be concerned about any of them.

At this point, there are two possibilities:
(a) You are going to load a program that has been provided to you by your instructor; you are to compile it and run it (possibly modifying it first to meet assignment requirements).
(b) You are going to type in a program from scratch.
These two cases will be considered separately.

Case A. Loading a program that your instructor has provided

A1. Download (or copy) the program components (one or more .cpp files, and also any .h files) into the project folder that was just created.

A2. Return to Visual C++ Express Edition, and click Project/Add Existing Items…. You should see the Add Existing Items window, showing the names of the files you downloaded or copied:

A3. Select all of the files by clicking on the top one, and then holding down SHIFT while clicking on the bottom one. All should then be highlighted.

A4. Click Add. You should see a window like this:

On the left panel, you should see the .cpp and .h files that you have added to the project. You can now view and edit any of the .cpp or .h files by double-clicking on the filename. You are now ready to compile and run your program. Skip Case B and go to Compiling and Running Your Program on page 7.

Case B. Typing a program from scratch

B1. Select Project/Add New Item… You should see the following window:

Under Categories:, select Code. Then under Templates:, select C++ File (.cpp). In the Name: field, enter a file name, without the .cpp extension.

B2. You will see an edit window, with a tab having the file name you entered, followed by .cpp. Type your program.

Note: You can click the little + to the left of Source Files to see that your file appears in the list of source files.

Now continue to Compiling and Running Your Program.

Compiling and Running Your Program

C1. Click Build/Rebuild Solutions. At the bottom of the window, watch for error messages. If compiling and linking were successful, you should see something like

Build log was saved at "file://c:\Documents and Settings\Jack\My Documents\Visual Studio 2005\Projects\Project13\Debug\BuildLog.htm"
Project13 - 0 error(s), 0 warning(s)
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========

C2. To run the program, click Debug/Start Without Debugging.

After you have closed Visual C++ 2005 Expression (or even if you have not closed it), you can also run your program this way:

If you want to do this, you may need to add the statement
    system("Pause");
just before the return statement of the main program, in order to prevent the program's window from closing before you have a chance to view the output.

In fact, you can copy that .exe file to anywhere you like (even another computer, provided the Microsoft .NET 2.0 runtime environment is installed on it) and run it from there.

Please report any difficulties or discrepancies with this procedure to j2hirschfelder@comcast.net.