Getting Started in Visual C++

This page will guide you through creating a Visual C++ console project from scratch.  An easier way is to use one of the Visual C++ Project Makers to automate this process.  There is a different set of instructions depending on which Visual Studio compiler you use.  (To determine which compiler you have, run the compiler and then choose About from the Help menu.)  Choose one of the following options.

Visual Studio.NET

Visual Studio Express Edition

You can download the free Visual Studio C++ Express Edition at

 http://msdn.microsoft.com/vstudio/express/visualc/default.aspx

Visual Studio 6

 

 

Getting Started with Visual Studio.NET

 

1. Launch the Program

Then close all windows and dialog boxes within the Visual Studio main window.

2. Create a Project

bulletFrom the File menu, choose New, then Project.  Under Project Types, expand the tree view to Visual C++ Project -> Win32, then choose the template for Win32 Console Project.  Give it a name and a location.  Click OK.
bulletIn the Win32 Application Wizard, select Application Settings.  Choose Empty Project and then click the Finish button.

3. Open a C++ Code Window

bulletFrom the View menu, choose Solution Explorer, then right-click the name of your project in the tree view.  Select Add -> Add New Item.  Under Categories, expand the tree view to Visual C++ -> Code, then choose the template for C++ file (.cpp).
bullet Choose a name such as main.cpp, and then click the Open button.

4. Programming

bulletType your program into the large, blank window.  You may close the other windows.
bulletWhen your program is entered, from the Debug menu choose Start Without DebuggingIf asked whether you want to build, choose “yes”.
bulletAny errors will be indicated in the bottom output window.  Click on the first error message to go to the error.  (You may have to scroll up in the output window to find the first error message.)

 

//A program in C++ to demonstrate console-window output
#include <iostream>      //Library for input and output
using namespace std;   //Working in standard namespace
int main()
{
   cout << "Hello World" << endl;
   return 0;
}

 

5. When You Are Done

bullet

Get back into your program at another time by clicking the .sln  file in the folder.

bulletIf you don't see your code window, then go to the menu View -> Solution Explorer.  Expand the tree until you see your .cpp file and click on it.
bulletThrow away the Debug folder to save enormously on disk space.

 

Getting Started with Visual Studio Express

You can download the free Visual Studio C++ Express Edition at

 http://msdn.microsoft.com/vstudio/express/visualc/default.aspx

 After the program is installed, here is how to get started.

 1. Launch the Program

 2. Create a Project

From the File menu, choose New, then Project. Under Project Types, expand the tree view to Visual C++ -> General, then choose the template for Empty Project.  Give it a name and a location.  Click OK.

 3. Open a C++ Code Window

From the Project menu, choose “Add New Item” Under Catagories, expand the tree view to Visual C++ -> Code, then choose the template for “C++ File(.cpp)” Give it a name (and a new location if desired). Click Add.

 4. Programming

bullet

Type your program (see example  below) into the large, blank window.  You may close the other windows.

bullet

When your program is entered, from the Debug menu choose Start Without Debugging.  If asked whether you want to build, choose “yes”.

bullet

 Any errors will be indicated in the bottom output window.  Click on the first error message to go to the error.  (You may have to scroll up in the output window to find the first error message.)

 

//A program in C++ to demonstrate console-window output

#include <iostream>      //Library for input and output

using namespace std;   //Working in standard namespace 

int main()
{
   cout << "Hello World" << endl;

   return 0;
}

 

5. When You Are Done

bulletGet back into your program at another time by clicking the .sln file in the folder.
bulletIf you don't see your code window, then go to the menu View -> Solution Explorer.  Expand the tree until you see your .cpp file and click on it.
bulletIf there is a folder called Debug or Release in your project folder, you can safely throw it away.  This will save enormously on disk space.

Getting Started with Visual Studio 6.0

 

1. Launch Visual Studio 6.0

2. Create a Project

bulletFrom the File menu, choose New.  Select the Project tab.
bulletFrom the choices on the left, choose Win32 Console Application.
bulletType a name into the Project Name space.  This will be the name of the folder containing your files.
bulletSelect the button after the Location text box to choose a place to store your project folder
bulletIf a dialog box pops up, select Empty Project, then click the Finish button.

3. Open a C++ Code Window

bulletFrom the File menu, choose New.  Select the Files tab.
bulletFrom the choices on the left, choose C++ Source File.
bulletGive the file a name such as main.cpp.

4. Programming

bulletType your program into the large, blank window.  You may close the other windows.
bulletWhen your program is entered, from the Build menu choose Execute.
bulletAny errors will be indicated in the bottom output window.  Click on the message to go to the error.  (You may have to scroll up in the output window.)
//A program in C++ to demonstrate console-window output
include <iostream>      //Library for input and output
using namespace std;   //Working in standard namespace
int main()
{
   cout << "Hello World" << endl;
   return 0;
}

5. When You Are Done

bullet

Throw away the Debug folder to save enormously on disk space.

bullet

Get back into your program at another time by clicking the .dsw  file in the folder.