26-06-2012, 05:03 PM
Working with the Visual C++ 2008 IDE
Working with the Visual.pdf (Size: 552.64 KB / Downloads: 40)
Microsoft’s Visual C++ 2008 is an incredibly full-featured product, and
this minibook can’t even begin to discuss most of the tasks you can
perform using Visual C++. What you’ll discover in this minibook, starting
with this chapter, are the traditional options that Visual C++ 2008 offers,
including Win32 console applications and Microsoft Foundation Classes
(MFC) graphical applications. You won’t find any coverage of Microsoft’s
.NET Framework and managed coding.
Visual C++ 2008 is the Microsoft view of what C++ should offer, which may
or may not be the same as your view. Let’s just say that Microsoft adds a
wealth of features to Visual C++, some of which you’ll like and others that
you might want to do without. (We know of some developers who go out of
their way to overcome the less-liked features in Visual C++ 2008.) For the
most part, this minibook goes with the flow and shows you what Visual C++
2008 has to offer so you can make your own decisions.
The focus of this chapter is the Integrated Development Environment (IDE).
As you progress through the chapter, you discover how Visual C++ differs
from the CodeBlocks IDE used for the other minibooks. In addition, you’ll
create your first Visual C++ application, a simple console application that
shows, even in this regard, that Microsoft is a bit different.
Understanding the Project Types
One of the first things you’ll notice is that Visual C++ offers a lot of different
projects, all of which interact with Windows. To see the projects that Visual
C++ has to offer, choose File➪New➪Project in Visual Studio. You see the
New Project dialog box shown in Figure 1-1. The templates used to create
new projects appear in the Visual C++ folder.
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 application.
This example requires only one project — the executable used to
display “Hello World” at the command prompt.
Running the application
At this point, your application is ready to compile and run. To compile an
application using Visual C++, you choose Build➪Build Solution. In the Output
window, you see a series of build messages like the ones shown in Figure 1-3.
If there are any errors when you compile your application, you see them in
the Error List window (simply click the Error List tab shown in Figure 1-3 to
see the errors).
Obtaining coding help
You have access to a wealth of help options. The first place most people
look is the Help menu. The Help menu does contain a wealth of options, but
the help you receive is generic. These options may open a copy of MSDN
Library, but you still have to look for the topic you need help with and most
developers want something faster.