undefined reference to libnet-1.0.2a functions, Linux C

566 Views Asked by At

i'm using Ubuntu and i'm actually trying to install libnet v.1.0.2a in order to build and write network packets. i'm aware that i'm installing the older version but i'd rather stick with it since it suits me well. the problem is that when i write code and try to compile it, "undefined reference" error is showing up on all the functions of libnet library. i checked /usr/include and the header files containing declarations are all present. on my compiling command i wrote:

$sudo gcc $(libnet-config --defines) -o aa aa.c -lnet

but it is still coming with undefined references. can someone help me please?

1

There are 1 best solutions below

0
S.Saliba On

Actually i solved the problem. What was wrong is that my compiler was linking to the version 1.1 whereas my code was written with the 1.0 version. That is because i installed the two versions by mistake and they don't coexist. What i had to do was to delete the two libraries and install the new version exclusively. And than i converted all my codes to the new version which is way simpler.