/Gi   (Enable Incremental Compilation)

OverviewHow Do ICompiler Options

The Enable Incremental Compilation (/Gi) option controls the incremental compiler, which compiles only those functions that have changed since the last compile. The compiler saves state information from the first compile in the project’s .IDB file (the default name is project*.***IDB or VC50.IDB for files compiled without a project). The compiler uses this state information to speed subsequent compiles.

To find this option in the development environment, click Settings on the Project menu. Then click the C/C++ tab, and click Customize in the Category box.

The following options prevent incremental compilation:

  • /Gi– (Disable Incremental Compilation)

  • /Z7 (Place Debug Information in Object Modules)

  • /FA (Generate a Listing File)

  • /Zg (Generate Function Prototypes)

  • /E, /EP, or /P (Preprocess the File)

If the compiler cannot find the project’s .PDB file or .IDB file (or either is read-only), it cannot incrementally compile.

Note   Object (.OBJ) files created with the Enable Incremental Compilation option are larger than those with incremental compilation disabled because of padding. Padding allows the compiler to add to the .OBJ file without recreating it. Because these .OBJ files are larger, you should disable incremental compilation when building a version of your program for release.