Re: [xml] Please help... How to use libxml in a C++ project(KDevelop)



Sven writes:

I just started an Open Source Project in C++ under Linux using KDevelop. 
I'm not (yet) very common with all this make, automake, autoconf stuff 
and the millions of settings and options this tools and the gcc has. 
I've got my Kdevelop project in one folder and want to keep the libxml 
source files in another folder. I added the compiler option 
-I<pathtolibxmlsources> but I get undefined reference error while 
linking for each libxml function I try to call...

Besides the -I<path_to_libxml_headers>, you'll need to specify the
library, such as -lxml2 (libxml2). Like Daniel said you may use
xml2-config for these.

In the Makefile you can do:

CPPFLAGS=$(shell xml2-config --cflags) # or -I/usr/include (for example)
LDFLAGS=$(shell xml2-config --libs) # or -L/usr/lib -lxml2 (for example)
CC=g++

all: read-it
read-it: read-it.o
read-it.o: read-it.cpp read-it.hpp

hth, Elizabeth



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