How to link a non-standard header file into a C compiler -
i'm trying use non-standard header file (http://ndevilla.free.fr/gnuplot). used in lots of codes in various different places on computer. have put header file , object file in every folder needed preprocessor directive:
#include "gnuplot_i.h"
in file. there way can put header file in 1 place can reference other standard header file. cheers.
compile -i<directory>
e.g.
compile -i/usr/local/gnuplot/inc
.
also might worth reading on include paths , difference between:
#include <include_file.h>
and
#include "include_file.h"
linking in object file needs done explicitly same way c file, means (i believe) need full path. if archive proper library can use -l<library name>
, -l<library path>
instead. e.g.
gcc -i/usr/local/gnuplot/inc -l/usr/local/gnuplot/lib -lgnuplot -o my_prog my_prog.c
Comments
Post a Comment