sirio.bm 0 Newbie Poster

Developing on an ubuntu system, using code::blocks. Need to read and write to XML config files.

there is a DOM library for Gnome, libgdome2. Found a good source for this at http://gdome2.cs.unibo.it/

I am trying to compile the following code, which is more or less straight from the tutorial on the above site:

#include <stdio.h>
#include <gdome.h>

inline int read_port_config(){

        /* create DOM-specific variables */
        GdomeDOMImplementation *dom_impl;
        GdomeDocument *document;
	GdomeElement *root, *element;
	GdomeNodeList *childs;
	GdomeException exc;
	GdomeDOMString *name, *value;
	unsigned long iii, nchilds;

	/* First I get a DOMImplementation reference */
	dom_impl = gdome_di_mkref ();

	/* I load a new document from the file USI CONFIG_FILE_LOCATION */
	document = gdome_di_createDocFromURI(dom_impl, CONFIG_FILE_LOCATION, GDOME_LOAD_PARSING, &exc);

}

At first, compiler returns "error: gdome.h: no such file or directory." This is because `pkg-config --cflags --libs gdome2` needs to added to the project build options.

The project now builds fine, but when linking gives "undefined reference to `gdome_di_mkref'"

This is tricky. Turns out that `pkg-config --cflags gdome2` needs to go under compiler options, while `pkg-config --libs gdome2` needs to go under linker options.

ta-da. It now compiles. Figured I'd write it up so it would show on google when someone else searched for it.