C and C++ compilation system

C and C++ compilation system

This topic describes the UNIX®/ operating system tools used to generate an executable program from C and C++ language source files.

``Compiling and linking'', details the command line syntax used to produce a binary representation of a program -- an executable object file. It concentrates on the options to the cc(1) and CC(1C++) commands that control the process in which object files are created from source files, then linked with each other and with the library functions that are called in your program. As outlined in ``Introduction to programming in standard C and C++'', the major focus of this topic is on static vs. dynamic linking: how each model is implemented and invoked, and its relative merits.

Standard libraries are the focus of ``Libraries and header files''. Because the C language contains no intrinsic input/output facility, I/O must be carried out by explicitly called functions. On the UNIX® operating system, the functions that perform these and other high-level tasks have been standardized and grouped in libraries. They are convenient, portable, and optimized for your machine.

Likewise, C++ input/putput is supported by the iostream library, which is a component in the C++ Standard Libraries. These libraries are described in Programming with the pre-standard C++ libraries.

Header files contain definitions and declarations that serve as the interface between your program and the functions in these libraries. They also contain several functions such as getc and putc, that actually are defined as macros. The manual page will generally tell you whether what you are using is a macro or a function. Macros and functions are both used in the same way in your program. The descriptions of standard libraries in ``Libraries and header files'' show the header files that you need to include in your program if you call a function in those libraries. The manual page for each function also lists the required header files. ``How to use library functions'' shows how to use library functions in your program and how to include header files.

Next topic: Compiling and linking

© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 27 April 2004