Compile libxml program

Posted by Joys of Programming on in C/C++

For XML programming in C, you can make use of  certain libraries like libxml.  To compile a libxml program, you must be aware of the libraries and their installation.  xml2-config comes in bundled with libxml. With xml2-config, you can find out the various values needed to compile the libxml programs.

After installing libxml, you must check the path where the libxml header files are present


$ xml2-config --cflags
-I/usr/include/libxml2

To find the options for linking,

$ xml2-config --libs
-lxml2

Now you know both these values, you can compile your program containing libXML headers and functions in the following manner


$ gcc file.c `xml2-config --cflags --libs`

or in the following manner, using the values obtained before.

$ gcc file.c -lxml2 -I/usr/include/libxml2



Tags: , , , , , ,

Comments:

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Copyright © 2009-2012 Joys of Programming All rights reserved.
Desk Mess Mirrored v1.8.1 theme from BuyNowShop.com.