C++

COMPILING THE SOURCE CODE

Although the source code in your file is somewhat cryptic, and anyone who doesn’t know C++ will struggle to understand what it is for, it is still in what we call human-readable form. Your source code file is not a program, and it can’t be executed, or run, as a program can.

To turn your source code into a program, you use a compiler. 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. In Borland’s Turbo C++ you pick the RUN menu command or type

tc <filename>

 

from the command line, where <filename> is the name of your source code file (for example, test.cpp). Other compilers may do things slightly differently.

NOTE: If you compile the source code from the operating system’s command line, you should type the following:

For the Borland C++ compiler: 
bcc <filename>

For the Borland C++ for Windows compiler: bcc <filename>

For the Borland Turbo C++ compiler:
tc <filename>

For the Microsoft compilers:
cl <filename>

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.

Back to Index