I'm trying to get XML parsing to work properly.
I tried to compile like so :
Code:
sh-2.05a$ gcc -o xml xml.c `./incxml.sh`
/tmp/ccsuZf4i.o: In function `main':
/tmp/ccsuZf4i.o(.text+0xf): undefined reference to `xmlParseFile'
collect2: ld returned 1 exit status
(a note about the above : incxml.sh looks like this :
Code:
#!/bin/sh
echo "-I/usr/include/libxml2"
)
My {trival} prog is as follows:
Code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <libxml/xmlmemory.h>
#include <libxml/parser.h>
int main(int argc, char * argv[]) {
xmlDocPtr xml_doc;
if (NULL == xmlParseFile("test.xml")) {
fprintf(stderr, "XML Parsing failed. Quitting......\n");
exit(1);
}
printf("Success!\n");
exit(0);
}
Is this a bug, or am I doing something incorrectly?