[libvirt] Compile time error in event-test.c

Michal Privoznik mprivozn at redhat.com
Fri Jan 10 14:28:58 UTC 2014

On 10.01.2014 11:15, Avanti Ajay wrote:
> Hi...
> I am trying to compile the event-test.c code of the libvirt package. I
> am getting this error :
> I know it is a loader problem. Do I need to install any binaries?
> administrator at administrator-desktop:~/Desktop/libvirt/examples/domain-events/events-c$
> gcc event-test.c -o event -lvirt
> /tmp/ccHd7ZUD.o: In function `main':
> event-test.c:(.text+0xac9): undefined reference to
> `virConnectRegisterCloseCallback'
> collect2: ld returned 1 exit status
> Thanks
> Avanti

I assume your system libvirt is too old. The
virConnectRegisterCloseCallback() API was introduced in the 0.10.0
release. Upgrade and you should be able to compile again.

BTW, since you already have a libvirt sources, why not build them? I
mean, the examples won't contain any API from the future, so your
sources already define the Register API. You can build the sources by

./autogen.sh --system && make

to install run:

sudo make install


More information about the libvir-list mailing list