gcc can't include libnet.h

I have installed the libnet from the port(/usr/ports/net/libnet)

when I compiled the t.c, I got an error.

Code:
---- t.c -----
#include <libnet.h>

.....
--------------

gcc t.c -o -lnet

====error====
t.c:2:20: error: libnet.h: No such file or directory
 
gcc from the base system on FreeBSD does not search anywhere under /usr/local/ for headers unless you specifically tell it to. The libnet port installs libnet.h to /usr/local/include/libnet11/. You should probably change the include directive to:

Code:
#include <libnet11/libnet.h>

And then use gcc like so:

Code:
gcc -I/usr/local/include -o t -lnet t.c

Adam
 
Thanks.

I finished it using the cmd

gcc -I/usr/local/include -L/usr/local/lib -o t -lnet t.c

and the code of t.c uses
Code:
#include <libnet11/libnet.h>
 
Back
Top