[avahi] undefined reference to `avahi_simple_poll_new'

Félix Arreola Rodríguez fgatuno.123 at gmail.com
Thu Jun 11 08:09:43 PDT 2009


2009/6/11 evanescent <coolnuwan at gmail.com>

> Hi,
> I got this compilation error while I try to write avahi client to publish
> service.
> I was trying to write the program from the scratch.
>
> Here is the program.
>
> [code]
>
> #include <stdio.h>
>
> #include <avahi-client/client.h>
> #include <avahi-client/lookup.h>
>
> #include <avahi-common/cdecl.h>
> #include <avahi-common/watch.h>
> #include <avahi-common/malloc.h>
> #include <avahi-common/error.h>
> #include <avahi-common/simple-watch.h>
>
> static AvahiSimplePoll *simple_poll = NULL;
>
> int main(int argc , char* argv)
> {
>   AvahiClient *client = NULL;
>   AvahiServiceBrowser *sb = NULL;
>   int error;
>   int ret = 1;
>   /*Allocate main loop object */
>
>   if (!(simple_poll = avahi_simple_poll_new()))
>   {
>     //TODO
>   }
> //TODO
> }
>
> [/code]
>
> And error is Here
>
> lsf at lsf-laptop:~/mesh_project/dalesa/src/im$ gcc publish_service.c
> /tmp/ccavp1Yk.o: In function `main':
> publish_service.c:(.text+0x27): undefined reference to
> `avahi_simple_poll_new'
> collect2: ld returned 1 exit status
>
> What is the wrong with this?
>
> Thank you.
>
> Nuwan Gunarathna
>
> _______________________________________________
> avahi mailing list
> avahi at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/avahi
>
>
You have to compile with ´pkg-config´ flags.

I don't remember what is the command, but I think that is
pkg-config --cflags --libs avahi-client
pkg-config --cflags --libs avahi-server

I'm not sure, but yes, you need the CFlags.
-- 
Atte. Félix Arreola Rodríguez,
Firmado con GPG, llave 223D869A
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/avahi/attachments/20090611/1670d21c/attachment.html 


More information about the avahi mailing list