It is compulsory to use -lpcap with gcc to compile libpcap program, but I don't know what this flag means. Can anybody help me??
$ gcc lpcap_demo.c -o lpcap_output.o -lpcap
gcc -l instructs GCC to link the program with the library given as command-line option, and
pcap is the name of
lib prefix of the library name is implied, so if you were to write
-lpthread you would link with
libpthread, a POSIX thread library,
-lrt links with
librt, which is a real time extension library and so on and so forth :)
So yeah, it is compulsory to compile with
-lpcap as long as you are using exported symbols from the pcap library.
Does this answer your question? :)
You can get more information by typing this command in the terminal:
... and search for the
Here is the man page on GCC :