I'm working on Fedora 17 and I want to program with libpcap. The problem is that my computer isn't finding pcap.h, which is really wierd since I've installed libpcap and libpcap-devel. Also wireshark and snort works on my station which I believe uses that library. So when I compile my code with ...
#include <pcap.h>
... Code
And use gcc my_file.c -lpcap, I get compiler errors that say ... can't find pcap.h. Whats odd is that I see my libpcap.so files in /libraries/ directory. I've done ..
yum install libpcap and yum install libpcap-devel
I don't know why Fedora is doing this to me.
Thanks for any help!
Your library might be missing, install it and link it
yum install libpcap-devel
In your makefile add:
-L/usr/lib -lpcap
Try
~$ whereis pcap
Then as mata said
gcc -lpcap -I{path} file.c
where {path}
is the path that whereis
gave you, you will choose the one with the pcap.h substring at the end (without the pcap.h part).
You'll have to specify the folder where the headers are installed, for example:
gcc -I/usr/include/pcap my_file.c -lpcap
Try locate pcap.h
to find the right directory to use with the -I
switch.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With