Linking your compiled applications with XL C/C++

By default, you do not need to do anything special to link an XL C/C++ program. The compiler invocation commands automatically call the linker to produce an executable output file.

For example, running the following command:
xlc++ file1.C file2.o file3.C
compiles file1.C and file3.C to produce the object files file1.o and file3.o, then all object files (including file2.o) are submitted to the linker to produce one executable.

Compiling and linking in separate steps

To produce object files that can be linked later, use the -c option.

xlc++ -c file1.C               # Produce one object file (file1.o)
xlc++ -c file2.C file3.C       # Or multiple object files (file1.o, file3.o)
xlc++ file1.o file2.o file3.o  # Link object files with default libraries
For more information about compiling and linking your programs, see: