< previous page page_12 next page >

Page 12
To turn your source code into a program, a compiler is used. How you invoke your compiler and how you tell it where to find your source code will vary from compiler to compiler; check your documentation.
If you compile the source code from the operating system's command line, you should type the following:
For the Borland C++ bc <filename>
compiler
For the Borland C++ bcc <filename>
for Windows compiler
For the Borland tc <filename>
Turbo C++ compiler
For the Microsoft cl <filename>
compilers
For the DJGPP gxx <filename> -o
<output executable name>

compiler

Compiling in an Integrated Development Environment
Most modern compilers provide an integrated development environment. In such an environment, you typically choose Build or Compile from a menu, or there can be a function key you press to build your application. Again, you'll want to check the documentation for your particular compiler.
Linking Your Program
After your source code is compiled, an object file is produced. This file is often named with the extension .obj. This is still not an executable program, however. To turn this into an executable program, you must run your linker.
C++ programs are typically created by linking together one or more OBJ files with one or more libraries. A library is a collection of linkable files that you created, were supplied with your compiler, or that you purchased separately. All C++ compilers come with a library of useful functions (or procedures) and classes that you can include in your program. A function is a block of code that performs a service, such as adding two numbers

 
< previous page page_12 next page >

If you like this book, buy it!