There are two things:
1. Instead of putting the whole path to the include files in the #include line, it is more usual to put just the source file name, and then in the build options, pass an include search path to the compiler. If you are using gcc, this is done with the -I option.
2. When linking to external libraries, you must tell the linker what library defines the symbols which you have used. For example, the sin function is declared in the math.h header, so the source needs to #include this. The implementation of the sin function is found in the libm.a file, and so the parameter -lm must be passed to the linker stage. (the name of the library without the lib prefix and the .a or .so suffix). The linker will check some standard paths (described in the linker manual page), but if your library is installed in a non-standard location, you can provide a linker path option using -L.
For example, consider a program which calls a function called myfunc, declared in mylib.h and implemented in libmylib.a. If the mylib.h file is found in /home/matthew/include, and the libmylib.a file is found in /home/matthew/lib, and the program file, called "main.cpp" contains this:
Code:
#include "mylib.h"
int main()
{
...
}
The command to build the executable would be:
Code:
g++ -I/home/matthew/include -L/home/matthew/lib -lmylib main.cpp -o main