Your problems are likely environmental.
Here is a simple shell script I use that will build all of the examples in the
examples directory. This assumes a custom install location for libxml2 in
/opt/libxml2.
# build from inside the examples directory.
export XML_DIR=/opt/libxml2
export PATH=${XML_DIR}/bin:${PATH}
export LD_LIBRARY_PATH=${XML_DIR}/lib:${LD_LIBRARY_PATH}
build() {
gcc -I${XML_DIR}/include/libxml2 -L${XML_DIR}/lib -lxml2 -lz -lm -o ${1} ${1}.c
}
build io1
build io2
build parse1
build parse2
build parse3
build parse4
build reader1
build reader2
build reader3
build reader4
build testWriter
build tree1
build tree2
build xpath1
build xpath2
# run things, if you want...
Thomas Floodeen, Jr.
Mentor Graphics BSD
720.494.1133
From: Tong Mao [mailto:[email protected]]
Sent: Thursday, April 07, 2011 8:53 AM
To: Floodeenjr, Thomas; [email protected]
Subject: RE: [xml] Question about the path of libxml2 library
Hi Thomas,
Thank you very much for your reply.
I will try your solution.
Do you know why I still get the error notice (no such file or directory) even I
copy the libxml folder out of the libxml2,
or change the code to #include <libxml2/libxml/xxx.h> ?
Linux is new for me, lack some background knowledge. Sorry.
BR,
Tong
________________________________
From: [email protected]
To: [email protected]; [email protected]
Subject: RE: [xml] Question about the path of libxml2 library
Date: Thu, 7 Apr 2011 14:39:21 +0000
How about when you build, specify the include path:
gcc -I${XML_DIR}/include/libxml2 -L{XML_DIR}/lib -lxml2 -lz -lm -o file file.c
Thomas Floodeen, Jr.
Mentor Graphics BSD
720.494.1133
From: [email protected] [mailto:[email protected]] On Behalf Of Tong Mao
Sent: Thursday, April 07, 2011 8:26 AM
To: [email protected]
Subject: [xml] Question about the path of libxml2 library
Hello everyone,
Here I have a small question about the path of libxml2 library.
I need to modify my colleague's code, which use the libxml2 functions.
I already install the libxml2 packet. But got some errors for these
lines(cannot find the files):
#include <libxml/parser.h>
#include <libxml/encoding.h>
#include <libxml/xmlwriter.h>
I find the default path for these headers are:" include/libxml2/libxml ", not "
/include/libxml ".
I think I made some mistake, because every example online use these code:
#include <libxml/xxx.h>
Should I "cp" libxml folder out, or change #include xxx? Or there's standard
way to solve this problem?
Thank you very much for your help.
BR,
Tong
_______________________________________________
xml mailing list, project page http://xmlsoft.org/
[email protected]
http://mail.gnome.org/mailman/listinfo/xml