Datasheet

Book VII
Chapter 1
Working with the
Visual C++ 2008 IDE
and Projects
717
Creating a New Win32 Console Application
Some templates create more than one kind of application. In this case, a
wizard guides you through the process of defining the application type. For
example, even though you see only one MFC Application template in the
Visual C++\MFC folder, this one template creates a number of application
types, as you discover in Chapters 2 and 3.
Creating a New Win32 Console Application
The Win32 Console Application template shown in Figure 1-1 helps you
create an application that executes at the command prompt. The application
won’t have any fancy Windows interface elements. In fact, the result is very
much like the majority of the CodeBlocks applications created in the other
minibooks. However, console applications do provide useful services and
they’re a good place to begin discussing Visual C++ and the Visual Studio
IDE. The following sections describe how you can create your own Win32
console application.
Defining the project
Visual Studio provides two levels of application management. The top level
is a solution. A solution is the set of executables needed to create a complete
application. Every application has only one solution. The second level is the
project. A project contains the files needed to create a single executable. A
solution can contain as many projects as needed to create a complete appli-
cation. This example requires only one project — the executable used to
display “Hello World” at the command prompt.
Before you can begin writing code for a project, you need to define the
project itself. The following steps describe how to create a Win32 Console
Application project:
1. Choose FileNewProject.
You see the New Project dialog box (refer to Figure 1-1).
2. Select the Visual C++\Win32 folder in the Project Types list.
Highlight the Win32 Console Application template in the Templates
list.
3. Type a project name in the Name field (the example uses Hello
World).
The New Project dialog box automatically changes the Solution Name
field content to match the project name. You can always type a different
solution name if desired.
4. Click Browse.
You see a Project Location dialog box.
44_317358-bk07ch01.indd 71744_317358-bk07ch01.indd 717 7/22/09 11:44:50 PM7/22/09 11:44:50 PM