Although a precompiled file is not a text file, you use it like you would a regular header file. To include a precompiled header file in a source code file, use the #include directive.
The following listing shows an example.
// sock_header.pch // When compiled or precompiled, this file will generate a // precompiled file named "sock_precomp.mch" #pragma precompile_target "sock_precomp.mch" #define SOCK_VERSION "SockSorter 2.0" #include "sock_std.h" #include "sock_string.h" #include "sock_sorter.h"
The following listing shows another example.
// sock_main.c // Instead of including all the files included in // sock_header.pch, we use sock_precomp.h instead. // // A precompiled file must be included before anything else. #include "sock_precomp.mch" int main(void) { // ... return 0; }