Well, you tried to use function trunc. You know its name. But do you know its code? What the algorithm does it execute whenevre you use 'trunc()'?
You can divide the compilation process into two steps. The first - creating of the object file. It contains your code and etry-points - the functions you have not written by yourself but you use them, they are declared in the included headers.
The second stage - linking your object file with different libraries, which contain all necessary functions (e.g. trunc() or sqrt()). It defines where entry-points should find their according function codes (exact algorithms). These functions are stored in the binary state in the shared libraries. I know that anything from math.h is in the libm.so library. So you should point the linker (an application, which executes the second stage of the compiling) to the appropriate library (libm.so in you case). You can do it with the '-l' option followed by the library name.
Library name could be either the explicit path (/usr/lib/libm.so) or implict, in the last case linker will add 'lib' prefix and '.so' extension to the name you specify, for any library begins with 'lib' and ends with '.so' (and, maybe a version number as well).
The most important thing. Where can one find which library contains the function one find in any header? One should read man-page abit more attentively. In your case see trunc(3) manpage, the SYNOPSIS finishes with: