Linking error : undefined reference to `avahi_alternative_service_name'
-
13-12-2019 - |
Question
in know i need to locate this symbol in library.. I am trying to compile avahi based test code to view services. But i am getting undefined reference to
avahi_alternative_service_name'`.. I don't know which library contain this,I am running UBUNTU 12.04. I tried to install several packages but no success.. Any idea
Thanks..
I have following packages installed
dpkg --get-selections | grep avahi
avahi-autoipd install
avahi-daemon install
avahi-utils install
libavahi-cil-dev install
libavahi-client-dev install
libavahi-client3 install
libavahi-client3:i386 install
libavahi-common-data install
libavahi-common-data:i386 install
libavahi-common-dev install
libavahi-common3 install
libavahi-common3:i386 install
libavahi-core7 install
libavahi-glib-dev install
libavahi-glib1 install
libavahi-gobject0 install
libavahi-ui-dev install
libavahi-ui-gtk3-0 install
libavahi-ui0 install
libavahi1.0-cil install
command
gcc -fpermissive testAvahi.c -o testAvahi
Solution
Actually needed to locate libraries and then needed to pass them to linker, So follwing command did work for me
gcc -fpermissive testAvahi.c -o testAvahi -L/usr/lib/x86_64-linux-gnu/ -lavahi-client -lavahi-common
OTHER TIPS
if you have a common folder where you place your c++ libraries you can check search for the function using the nm command something like
cd /usr/lib
nm -AC * | grep avahi_alternative_service_name
The nm utility is available in binutils(sudo apt-get install binutils)