0

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 toavahi_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

twid
  • 6,368
  • 4
  • 32
  • 50
  • How are you compiling your code? – Vikas Oct 03 '12 at 15:55
  • Show the command line used to compile/link - it may be as simple as having the library specified in the wrong place (It needs to be after any objects or libs that depend on it). – Michael Burr Oct 03 '12 at 16:24
  • 1
    @twid, so you are not linking your compiled objects to any library. Do `gcc -o testAvahi testAvahi.c -l `. Check girish's answer to find out which avahi library provides the name required. If it is for example say libXYZ.a, your command should look like: `gcc -o testAvahi testAvahi.c -l XYZ`. – Vikas Oct 03 '12 at 17:36

2 Answers2

2

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

twid
  • 6,368
  • 4
  • 32
  • 50
1

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)

gpr
  • 485
  • 1
  • 5
  • 15