- Prefix header
In
computer programming , a prefixheader is a feature found in some C orC++ compilers used to simplify code and/or to reduce compilation time.Overview
In the C and
C++ programming languages, aheader file is a file whose text is automatically included in another source file by thecompiler , usually by the use ofcompiler directive s at the beginning of the source file. A prefix header differs from a normal header file in that it is "automatically" included at the beginning of every source file by the compiler, without the use of any compiler directives.Prefix headers are usually pre-compiled in order to reduce compilation times.
Example
On
Mac OS X , theXcode build system generates prefix headers automatically for new projects. A new Cocoa project, for instance, gets a prefix header that looks like this:As a result, it is unnecessary to explicitly include any of the above files in any
Objective-C code in the program, although doing so is harmless, in the case of Objective-C because of the semantics of the#import
directive, but more generally with#include
because of the use ofinclude guard s.Similar prefix headers are generated for other types of project.
See also
*
Header file
*Precompiled header External links
* [http://developer.apple.com/documentation/DeveloperTools/Conceptual/XcodeBuildSystem/800_bs_speed_up_build/chapter_8_section_2.html Xcode User Guide: Using a Precompiled Prefix Header]
Wikimedia Foundation. 2010.