When
you build from C sources, object files are produced
automatically. VisualAge C++ provides a C compiler that creates an
object file from each non-included C source file in the
traditional manner.
To
output object files when you build from C++ sources, specify an
object file as the type of the target. When you build from C++
sources, VisualAge C++ performs incremental builds and does not
produce object files unless you ask for them explicitly.
All
targets built from C++ sources are specified in the configuration
file. Unlike the C compiler, the C++ compiler can combine the
code generated from more than one C++ source file into one object
file. The mapping of source files to target files in the
configuration file determines how many C++ sources are used to
build each target object file. For example, this excerpt from a
configuration file builds an object file that contains the code
generated from two C++ source files:
target "myobject.obj" {
source "a.cpp", "b.cpp"
}
Specifying
the same source file for more than one target can result in
violations of the one-definition rule, so you usually do not
attempt to create an object file as well as another target from
the same source file. You can get around the one-definition rule
with a two-step build. For example, to build both an executable
file and an object file from at least one common C++ source file,
you can follow these steps:
You can
use the object files produced by VisualAge C++ as input to linkers
other than the VisualAge C++ linker. If you use the ilink
linker supplied with VisualAge C++ for OS/2 3.0 and IBM C and C++ Compilers 3.6 to build a DLL from
object modules created by VisualAge C++, make sure you specify the ilink
option /include:_dllentry. The ilink
linker does not automatically generate a reference to _dllentry
and the DLL is not initialized properly at run-time without this
entry point.
![]()
Incremental C++ Builds
C Compilation
Configuration Files
![]()
Change a Build Setup
Add or Change Source
Files
Add or Change Targets
Build
![]()
Types of Source Files
Types of Target Files
