Now i moved to libpcap-0.6.2 and it give this link error while compiling.
I changed the libpcap and again it works perfectly.
It appears that your libpcap-0.6.2 was compiled using a version of yacc
that doesn't support -p. If you can easily remedy that (say by using
bison), that should do the trick. Since your libpcap-0.4 doesn't have this
problem, it seems likely your system has the necessary flavor of yacc, but
for some reason ./configure didn't find it when building libpcap.