3.1 Using the Standard C and Math Libraries
Building an application which utilizes the standard C and math libraries requires two types of files: header files and library files.
Header Files
All standard C library entities are declared or defined in one or more standard headers. To make use of a library entity in a program, write an include directive that names the relevant standard header.
The contents of a standard header is included by naming it in an include directive, as in:
#include <stdio.h> /* include I/O facilities */
The standard headers can be included in any order. Do not include a standard header within a declaration. Do not define macros that have the same names as keywords before including a standard header.
A standard header never includes another standard header.
Library Files
The archived library files contain all the individual object files for each library function.
When linking an application, the library file must be provided as an input to
the linker (using the --library
or -l
linker option)
such that the functions used by the application may be linked into the application.
A typical C application will require these library files: libc99-elf.a, libc99-pic30-elf.a and libm-elf.a. These libraries will be included automatically if linking is performed using the compiler.