libxml error

I’m a newbie on QNX programming.
I installed libxml, and in my C project, i added Include paths: /usr/include/gnome-xml, libraries path : /usr/lib with -lxml. But when i build my project, i get problems :
undefined reference to ‘xmlParseFile’
undefined reference to ‘xmlDocGetRootElement’

I don’t know why? Please help me…

Anhthi,

Are you trying to use the expat XML parser or something else?

If so, you want to link with -lexpat

Also I took a quick look inside all the XML libraries and I don’t see an xmlParseFile routine anywhere. Are you sure you are using the right name.

Tim

Hi, the headers are in:

/opt/include/libxml2/libxml/parser.h
xmlDocPtr xmlParseFile (const char *filename);

/opt/include/libxml2/libxml/tree.h
xmlNodePtr xmlDocGetRootElement (xmlDocPtr doc);

Maybe you have to add to the make line -I /opt/include/libxml2/ and include <libxml/tree.h> and include <libxml/parser.h>

I could compile a simple example with those two functions…

Juan Manuel

You are linking against xml lib, aren’t you?

-lxml2 maybe?

Are you sure you are linking against the right libxml?

I believe QNX has a xml library on the system by default. So you could be using the headers from the xml you installed and linking against a different library???

Thanks for all your replication. I found out the reason why? -lxml. I added extra library path /opt/lib instead of /usr/lib, and it ran successfull.