[xml] can't find libxml/xmlmemory.h and libxml/parser.h files



Hi,

I am trying to use libxml routines in my code to parse xml documents. I got the tarball from the site and ran configure and make commands. I didn't run all the commands.

Then copied the generated libxml2.a file and /include/*.h files to  separate folders.

Now, I ran the compiler as shown below.

gcc -o xmlt -I/sample/lib/libxml xmltest.c -L/sample/lib -lxml2

I was assuming that it would pick up header files from libxml folder where I placed them and link the libxml2.a from the lib folder where I placed it. Obviously I was wrong because the compiler is showing the following errors. I would appreciate any pointers to the problem and a solution. As for the code, I am using the same file as given at the url: http://xmlsoft.org/tutorial/apc.html

xmltest.c:4:30: libxml/xmlmemory.h: No such file or directory
xmltest.c:5:27: libxml/parser.h: No such file or directory
xmltest.c:8: error: syntax error before "doc"
xmltest.c: In function `parseStory':
xmltest.c:10: error: `xmlChar' undeclared (first use in this function)
xmltest.c:10: error: (Each undeclared identifier is reported only once
xmltest.c:10: error: for each function it appears in.)
xmltest.c:10: error: `key' undeclared (first use in this function)
xmltest.c:11: error: `cur' undeclared (first use in this function)
xmltest.c:13: error: syntax error before "xmlChar"
xmltest.c: At top level:
xmltest.c:20: error: syntax error before "return"
xmltest.c: In function `parseDoc':
xmltest.c:26: error: `xmlDocPtr' undeclared (first use in this function)
xmltest.c:26: error: syntax error before "doc"
xmltest.c:27: error: `xmlNodePtr' undeclared (first use in this function)
xmltest.c:29: error: `doc' undeclared (first use in this function)
xmltest.c:36: error: `cur' undeclared (first use in this function)
xmltest.c:44: error: syntax error before "xmlChar"
xmltest.c: At top level:
xmltest.c:50: error: invalid type argument of `->'
xmltest.c:50: warning: data definition has no type or storage class
xmltest.c:51: error: syntax error before "while"
xmltest.c:56: error: redefinition of 'cur'
xmltest.c:50: error: previous definition of 'cur' was here
xmltest.c:56: error: invalid type argument of `->'
xmltest.c:56: warning: data definition has no type or storage class
xmltest.c:57: error: syntax error before '}' token
xmltest.c:59: warning: parameter names (without types) in function declaration
xmltest.c:59: warning: data definition has no type or storage class
xmltest.c:60: error: syntax error before "return"

thank you,
Ravi


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]