0% found this document useful (0 votes)
3 views

Object Oriented Programming Using c++[0893-0893]

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Object Oriented Programming Using c++[0893-0893]

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Appendix C

866

A common error when writing a new program is forgetting the statement


using namespace std;

If you leave this out, the compiler will complain that it doesn’t recognize cout, <<, endl, and
so on.
Before starting work on a new program, don’t forget to select Close Workspace from the File
menu. This ensures that you begin with a clean workspace. To open a program you’ve already
built, select Open Workspace from the File menu, navigate to its directory, and double-click the
file with the appropriate name and the .DSW extension.

Run-Time Type Information (RTTI)


A few programs, such as EMPL_IO.CPP in Chapter 12, “Streams and Files,” use RTTI. With
MVC++ you need to enable a compiler option to make this feature work. Select Settings from
the Project menu and click the C/C++ tab. From the Category list box, select C++ Language.
Click the check box named Enable Run-Time Type Information. Then click OK. This will
avoid various compiler and linker errors, some of which are misleading.

Multifile Programs
We’ve shown the quick and dirty approach to building programs. This approach works with
one-file programs. When projects have more than one file, things become slightly more com-
plicated. We’ll start by reviewing what’s meant by the terms workspace and project.

Projects and Workspaces


MVC++ uses a concept called a workspace, which is one level of abstraction higher than a
project. A workspace can contain many projects. It consists of a directory and several configu-
ration files. Within it, each project can have its own directory, or the files for all the projects
can simply reside in the workspace directory.
Conceptually it’s probably easiest, at least for the small programs in this book, to assume that
every project has its own separate workspace. That’s what we’ll assume in this discussion.
A project corresponds to an application (program) that you’re developing. It consists of all the
files needed to create that application as well as information about how these files are to be
combined. The result of building a project is usually a single .EXE file that a user can execute.
(Other results are possible, such as .DLL files.)

You might also like