Convert Included Sources to Primary Sources (C++)

When you build with VisualAge C++, you can specify C++ header files like any other source files in your configuration file. Source files listed in the configuration file are called primary sources. Alternatively, you can include header files in other source files, in the traditional manner, with #include preprocessor directives.

If you are planning to migrate source files by building in migration mode, you should do so before you convert included source files to primary source files. Migration builds process source files individually, in the order in which they appear in the configuration file. Therefore, functions, classes, and variables must be declared and macros must be declared in each file before they are used. For migration builds, include header files in the traditional manner. Migration builds may not be successful in the following circumstances:

Because regular VisualAge C++ builds perform orderless compile and process all source files at once, the order of declarations in header files and other source files does not matter. Therefore, the declarations you traditionally put in header files can be in primary sources. You should convert included header files to primary sources for the following reasons:

The converted source files can be compatible with traditional compilers because you can leave the #include directives in place. VisualAge C++ ignores #include directives if the included file is also a primary source.

You can use the configuration optimizer tool to convert header files, or you can modify your configuration file manually.

Convert the Configuration File Manually
Do not underestimate the task of manual conversion. You must determine which included files can be safely converted to primary sources without changing the meaning of targets built from the including source. If any of your converted header files define macros that must be visible in other sources, you must apply option macros(global) to them to convert them to macro sources and list them in the proper order in the configuration file, because global macros are preprocessed in the order in which the sources that define them appear in the configuration file. The configuration optimizer can do all this for you.

To convert included sources manually, make the following changes to your configuration file:



Configuration Files
Codestore
Incremental C++ Builds
C++ Source Files and Source Regions
Macros in C++ Source Files
One Definition Rule


Add or Change Source Files
Migrate Source Files
Set Build Options
Build


Build Options