Library and Linker Use
This topic describes the libraries that are available with the Cray C and C++ compilers and the linker.
This topic describes the libraries that are available with the Cray C and C++ compilers and the linker.
Cray C and C++ Libraries
Libraries that support Cray C and C++ are automatically available when using the CC or cc command to compile the programs. These commands automatically issue the appropriate directives to link the program with the appropriate functions. If the program strictly conforms to the C or C++ standards, there is no need to know library names and locations. If the program requires other libraries or if direct control over the linking process is wanted, more knowledge of the linker and libraries is necessary.
The Standard Template Library (STL) is a C++ library of container classes, algorithms, and iterators; it provides many of the basic algorithms and data structures of computer science. The STL is a generic library, meaning that its components are heavily parameterized: almost every component in the STL is a template. Be sure there is a complete understanding of templates and how they work before using them.
Linker
When using the cc or CC command to invoke the compiler, and the program compiles without errors, the linker is called. Specifying the -c option on the command line produces relocatable object files (*.o) without calling the linker. These relocatable object files can then be used as input to the linker command by specifying the file names on the appropriate linker command line.
cc -c target.cThen use file target.o as input to the linker or save the file to use with other relocatable object files to compile and create a linked executable file (a.out by default).
Because of the special code needed to handle templates, constructors, destructors, and other C++ language features, object files generated by using the CC command should be linked using the CC command.