Hello, I compiled the latest-from-cvs libvirt and was surprised to see link failures. It was because I used -fno-common: .libs/libvirt_la-hash.o:(.bss+0x0): multiple definition of `virDomainFlags' .libs/libvirt_la-libvirt.o:(.bss+0x0): first defined here libvirt_qemud-buf.o:(.bss+0x0): multiple definition of `qemud_packet_type' libvirt_qemud-qemud.o:(.bss+0x0): first defined here libvirt_qemud-buf.o:(.bss+0x4): multiple definition of `qemud_domain_runstate' libvirt_qemud-qemud.o:(.bss+0x4): first defined here Those happen when more than one compilation unit contains a non-extern declaration of the same global variable. In each of the three cases, the name in question appears only at the point of declaration, so one could conceivably simply remove the name, leaving the anonymous "enum". But then there would be no way to declare a variable to be of that type, so I chose to reuse the name, making it the name of the enum. If name space pollution is an issue, and applications that use those headers won't need those types, then it'd be better to remove the names altogether. Here's a patch: 2007-03-19 Jim Meyering <jim@xxxxxxxxxxxx> Remove global variables from header files. * qemud/protocol.h (qemud_domain_runstate): Declare a named enum and no variable, rather than a global variable of type "anonymous enum". (qemud_packet_type): Likewise. * src/internal.h (virDomainFlags): Likewise. Index: qemud/protocol.h =================================================================== RCS file: /data/cvs/libvirt/qemud/protocol.h,v retrieving revision 1.5 diff -u -p -r1.5 protocol.h --- qemud/protocol.h 15 Mar 2007 17:24:57 -0000 1.5 +++ qemud/protocol.h 19 Mar 2007 13:36:55 -0000 @@ -29,7 +29,7 @@ #include <net/if.h> /* for IF_NAMESIZE */ /* List of different packet types which can be sent */ -enum { +enum qemud_packet_type { QEMUD_PKT_FAILURE = 0, QEMUD_PKT_GET_VERSION, QEMUD_PKT_GET_NODEINFO, @@ -71,7 +71,7 @@ enum { QEMUD_PKT_GET_CAPABILITIES, QEMUD_PKT_MAX, -} qemud_packet_type; +}; #define QEMUD_PROTOCOL_VERSION_MAJOR 1 @@ -86,11 +86,11 @@ enum { #define QEMUD_MAX_ERROR_LEN 1024 /* Possible guest VM states */ -enum { +enum qemud_domain_runstate { QEMUD_STATE_RUNNING = 1, QEMUD_STATE_PAUSED, QEMUD_STATE_STOPPED, -} qemud_domain_runstate; +}; /* Each packets has at least a fixed size header. * Index: src/internal.h =================================================================== RCS file: /data/cvs/libvirt/src/internal.h,v retrieving revision 1.35 diff -u -p -r1.35 internal.h --- src/internal.h 16 Mar 2007 15:03:21 -0000 1.35 +++ src/internal.h 19 Mar 2007 13:36:55 -0000 @@ -155,10 +155,10 @@ struct _virConnect { * a set of special flag values associated to the domain */ -enum { +enum virDomainFlags { DOMAIN_IS_SHUTDOWN = (1 << 0), /* the domain is being shutdown */ DOMAIN_IS_DEFINED = (1 << 1) /* the domain is defined not running */ -} virDomainFlags; +}; /** * _virDomain: