Creating and Using Precompiled Headers (AIX)

You can improve your compile time by using precompiled headers. Use the -qgenpcomp and -qusepcomp compiler options to create and maintain precompiled header files for your application.

If you use these two options consistently, a precompiled header files is created if it does not exist, and used if it does exist. When a source file is changed, the precompiled version is automatically regenerated.

The compiler generates a single precompiled object for the first initial sequence of #include directives. The next time you compile, this single object can be used wherever that initial sequence appears. Since the precompiled object is only used in cases where the context is the same (same language, same beginning sequence of #include directives, compatible options and macro definitions), the precompiled object does not have to be reinterpreted every time it is included.

To get the most benefit from this new method, use the same initial sequence of headers wherever possible. The more files that share the same initial sequence, the greater the improvement in your compile time.

You can specify different names or directories for precompiled header files with the -qgenpcomp and -qusepcomp compiler options. This allows you to create more than one initial sequence, and further improve your compile time.

When you use precompiled header files, the following restrictions apply: