xerces-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mael Guillemot <guill...@idiap.ch>
Subject Help: compiling my own sample
Date Tue, 11 Feb 2003 08:52:52 GMT
Hello,

Xerces C++ is installed on my system (linux RedHat 7.2). If I run the
binary samples (i.e. DOMPrint, PParse ...), this is working perfectly.
They are located in /usr/local/xerces/bin

My question is how do I manage my own Makefile in order to compile my
own sample? Given that a HelloWorld file is in /home/mael/xml/ :

===============================
#include <iostream.h>
#include <stdlib.h>
#include <xercesc/parsers/SAXParser.hpp>

int main(int argC, char* argV[])
{
 cout<<" HelloWorld  ... testing  SAXParser class"<<endl;
 SAXParser* parser = new SAXParser;
delete parser;
return 0;
}

===============================

Here is the result of the compilation:

> make HelloWorld
g++     HelloWorld.cpp   -o HelloWorld
/tmp/ccQ982dH.o: In function `main':
/tmp/ccQ982dH.o(.text+0x80): undefined reference to
`SAXParser::SAXParser(XMLValidator *)'
collect2: ld returned 1 exit status
make: *** [HelloWorld] Error 1


I guess it is a problem of library link. How do I manage this in the
Makefile ?

Especially the setting of the env. var. XERCESCROOT and the link
-lxerces-c . I have to be root and do a ldconfig ?

This command:
$ g++ -I/usr/local/xerces/include HelloWorld.cpp -o HelloWorld
-L/usr/local/xerces/lib -lxerces-c

gives:
/usr/bin/ld: cannot find -lxerces-c
collect2: ld returned 1 exit status

Thanks for helping beginners,

Maƫl



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Mime
View raw message