I downloaded the Libpcap-1.7.4 library . when i want to run libpcap.o and libpcap.so.1.7.4, the following errors appear:
[root@localhost libpcap-1.7.4]# ./libpcap.a
./libpcap.a: line 1: syntax error near unexpected token `newline'
./libpcap.a: line 1: `!<arch>'
[root@localhost libpcap-1.7.4]# ./libpcap.so.1.7.4
Segmentation fault (core dumped)
Could you give me some advice about what I should do?
OS: Centos 6.x
Could you give me some advice about what I should do?
Not try to run libpcap - it's a library, not a program, so you can't run it, you can only link a program with it.
What you need to do is link a program with it, and then run the program.
For example, if you have a C source file named small_sniffer.c
, and you want to compile it and link it with libpcap, try
gcc -o small_sniffer small_sniffer.c -lpcap
for dynamic linking and
gcc -static -o small_sniffer small_sniffer.c -lpcap
to link entirely statically