[libvirt] Problems using libvirt (linking errors)

Johannes Formann johannes at formann.de
Fri Aug 29 02:29:24 UTC 2008


Hello,

I habe a problem using a recent libvirt-Version (0.4.4) (installed from
backports.org) in my own programms.
I had used an older Version a while ago, but I think something might
have changed in the API(?), since the old code has the same problems
now.

I include the headers
#include <libvirt/libvirt.h>
#include <libvirt/virterror.h>

but when linking, I'll get errors like
XSSserver.o: In function `XSSserver::XSSserverinitializeService(void*)':
/root/rsplib-2.5.0/rsplib/XSSserver.cc:68: undefined reference to
`virInitialize'
/root/rsplib-2.5.0/rsplib/XSSserver.cc:72: undefined reference to
`virConnectOpen'


here is the function:
bool XSSserver::XSSserverinitializeService(void* userData)
{
    if ( virInitialize() != 0) {
        puts("WARNING: vir Initializew failed\n") ;
        return false;
    }
    virCon=virConnectOpen(NULL);
    if (virCon != NULL ) {
        return true;
    }
    puts("WARNING: Initialisierung misslungen") ;
    return false;
}

Any hints what I've done wrong/how to debug that problem?

regards  Johannes




More information about the libvir-list mailing list