Sun Studio 12: C++ User's Guide

2.4.3 Consistent Compiling and Linking

If you do compile and link in separate steps, consistent compiling and linking is critical when using the following compiler options:

If you compile any subprogram using any of these options, be sure to link using the same option as well:

In the following example, the programs are compiled using the -xcg92 compiler option. This option is a macro for -xtarget=ss1000 and expands to: -xarch=v8 -xchip=super -xcache=16/64/4:1024/64/1.


 example% CC -c -xcg92 sbr.cc
 example% CC -c -xcg92 smain.cc
 example% CC -xcg92 sbr.o smain.o

If the program uses templates, it is possible that some templates will get instantiated at link time. In that case the command line options from the last line (the link line) will be used to compile the instantiated templates.