Programmation DOM avec xerces

Fermé
Goupfrancis
Messages postés
21
Date d'inscription
mercredi 24 octobre 2007
Statut
Membre
Dernière intervention
2 avril 2009
- 25 févr. 2009 à 23:56
Goupfrancis
Messages postés
21
Date d'inscription
mercredi 24 octobre 2007
Statut
Membre
Dernière intervention
2 avril 2009
- 26 févr. 2009 à 02:03
Bonjour, je suis débutant sur l'utilisation de Dom et de l'API xerces en c++ sous linux, j'ai installé les librairies lixerces-c-devel, lixercesc-0,lixerces-c28 sous mon mandriva free 2009; j'essaie d'éxécuter le code(fichier test.cc) suivant: pour creer un parser:

#include <xercesc/parsers/XercesDOMParser.hpp>
#include <xercesc/dom/DOM.hpp>
#include <xercesc/sax/HandlerBase.hpp>
#include <xercesc/util/XMLString.hpp>
#include <xercesc/util/PlatformUtils.hpp>
#include <iostream>

using namespace std;
using namespace xercesc;

int main (int argc, char* args[]) {

try {
XMLPlatformUtils::Initialize();
}
catch (const XMLException& toCatch) {
char* message = XMLString::transcode(toCatch.getMessage());
cout << "Error during initialization! :\n"
<< message << "\n";
XMLString::release(&message);
return 1;
}

XercesDOMParser* parser = new XercesDOMParser();
parser->setValidationScheme(XercesDOMParser::Val_Always);
parser->setDoNamespaces(true); // optional

ErrorHandler* errHandler = (ErrorHandler*) new HandlerBase();
parser->setErrorHandler(errHandler);

char* xmlFile = "/home/francis/Bureau/schema.xml";

try {
parser->parse(xmlFile);
}
catch (const XMLException& toCatch) {
char* message = XMLString::transcode(toCatch.getMessage());
cout << "Exception message is: \n"
<< message << "\n";
XMLString::release(&message);
return -1;
}
catch (const DOMException& toCatch) {
char* message = XMLString::transcode(toCatch.msg);
cout << "Exception message is: \n"
<< message << "\n";
XMLString::release(&message);
return -1;
}
catch (...) {
cout << "Unexpected Exception \n" ;
return -1;
}

delete parser;
delete errHandler;
return 0;
}

le programme compile mais à l'edition des liens j'ai la page d'erreurs suivante:

[francis@localhost Bureau]$ gcc -W -Wall test.cc -o test
test.cc: In function ‘int main(int, char**)’:
test.cc:31: attention : deprecated conversion from string constant to ‘char*’
test.cc: At global scope:
test.cc:11: attention : unused parameter ‘argc’
test.cc:11: attention : unused parameter ‘args’
/home/francis/tmp/cclsEcOL.o: In function `__static_initialization_and_destruction_0(int, int)':
test.cc:(.text+0x1d): undefined reference to `std::ios_base::Init::Init()'
test.cc:(.text+0x22): undefined reference to `std::ios_base::Init::~Init()'
/home/francis/tmp/cclsEcOL.o: In function `main':
test.cc:(.text+0x92): undefined reference to `xercesc_2_8::XMLUni::fgXercescDefaultLocale'
test.cc:(.text+0x97): undefined reference to `xercesc_2_8::XMLPlatformUtils::Initialize(char const*, char const*, xercesc_2_8::PanicHandler*, xercesc_2_8::MemoryManager*, bool)'
test.cc:(.text+0xa3): undefined reference to `xercesc_2_8::XMemory::operator new(unsigned int)'
test.cc:(.text+0xab): undefined reference to `xercesc_2_8::XMLPlatformUtils::fgMemoryManager'
test.cc:(.text+0xca): undefined reference to `xercesc_2_8::XercesDOMParser::XercesDOMParser(xercesc_2_8::XMLValidator*, xercesc_2_8::MemoryManager*, xercesc_2_8::XMLGrammarPool*)'
test.cc:(.text+0xf1): undefined reference to `__cxa_begin_catch'
test.cc:(.text+0x107): undefined reference to `xercesc_2_8::XMLString::transcode(unsigned short const*)'
test.cc:(.text+0x11f): undefined reference to `std::cout'
test.cc:(.text+0x124): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
test.cc:(.text+0x133): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
test.cc:(.text+0x143): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
test.cc:(.text+0x14e): undefined reference to `xercesc_2_8::XMLString::release(char**)'
test.cc:(.text+0x15a): undefined reference to `__cxa_end_catch'
test.cc:(.text+0x170): undefined reference to `__cxa_end_catch'
test.cc:(.text+0x19a): undefined reference to `xercesc_2_8::AbstractDOMParser::setValidationScheme(xercesc_2_8::AbstractDOMParser::ValSchemes)'
test.cc:(.text+0x1ad): undefined reference to `xercesc_2_8::AbstractDOMParser::setDoNamespaces(bool)'
test.cc:(.text+0x1b9): undefined reference to `operator new(unsigned int)'
test.cc:(.text+0x1e5): undefined reference to `xercesc_2_8::XMemory::operator delete(void*)'
test.cc:(.text+0x220): undefined reference to `xercesc_2_8::XercesDOMParser::setErrorHandler(xercesc_2_8::ErrorHandler*)'
test.cc:(.text+0x239): undefined reference to `xercesc_2_8::AbstractDOMParser::parse(char const*)'
test.cc:(.text+0x26e): undefined reference to `__cxa_begin_catch'
test.cc:(.text+0x284): undefined reference to `xercesc_2_8::XMLString::transcode(unsigned short const*)'
test.cc:(.text+0x29c): undefined reference to `std::cout'
test.cc:(.text+0x2a1): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
test.cc:(.text+0x2b0): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
test.cc:(.text+0x2c0): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
test.cc:(.text+0x2cb): undefined reference to `xercesc_2_8::XMLString::release(char**)'
test.cc:(.text+0x2d7): undefined reference to `__cxa_end_catch'
test.cc:(.text+0x2ed): undefined reference to `__cxa_end_catch'
test.cc:(.text+0x309): undefined reference to `__cxa_begin_catch'
test.cc:(.text+0x31a): undefined reference to `xercesc_2_8::XMLString::transcode(unsigned short const*)'
test.cc:(.text+0x332): undefined reference to `std::cout'
test.cc:(.text+0x337): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
test.cc:(.text+0x346): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
test.cc:(.text+0x356): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
test.cc:(.text+0x361): undefined reference to `xercesc_2_8::XMLString::release(char**)'
test.cc:(.text+0x36d): undefined reference to `__cxa_end_catch'
test.cc:(.text+0x383): undefined reference to `__cxa_end_catch'
test.cc:(.text+0x39f): undefined reference to `__cxa_begin_catch'
test.cc:(.text+0x3ae): undefined reference to `std::cout'
test.cc:(.text+0x3b3): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
test.cc:(.text+0x3bf): undefined reference to `__cxa_end_catch'
test.cc:(.text+0x3d2): undefined reference to `__cxa_end_catch'
/home/francis/tmp/cclsEcOL.o: In function `xercesc_2_8::XMLDeleter::~XMLDeleter()':
test.cc:(.text._ZN11xercesc_2_810XMLDeleterD0Ev[xercesc_2_8::XMLDeleter::~XMLDeleter()]+0x1f): undefined reference to `operator delete(void*)'
/home/francis/tmp/cclsEcOL.o: In function `xercesc_2_8::XMLDeleter::~XMLDeleter()':
test.cc:(.text._ZN11xercesc_2_810XMLDeleterD1Ev[xercesc_2_8::XMLDeleter::~XMLDeleter()]+0x1f): undefined reference to `operator delete(void*)'
/home/francis/tmp/cclsEcOL.o: In function `xercesc_2_8::XSerializable::~XSerializable()':
test.cc:(.text._ZN11xercesc_2_813XSerializableD2Ev[xercesc_2_8::XSerializable::~XSerializable()]+0x1f): undefined reference to `operator delete(void*)'
/home/francis/tmp/cclsEcOL.o: In function `xercesc_2_8::XSerializable::~XSerializable()':
test.cc:(.text._ZN11xercesc_2_813XSerializableD0Ev[xercesc_2_8::XSerializable::~XSerializable()]+0x1f): undefined reference to `operator delete(void*)'
/home/francis/tmp/cclsEcOL.o: In function `xercesc_2_8::XSerializable::~XSerializable()':
test.cc:(.text._ZN11xercesc_2_813XSerializableD1Ev[xercesc_2_8::XSerializable::~XSerializable()]+0x1f): undefined reference to `operator delete(void*)'
/home/francis/tmp/cclsEcOL.o:test.cc:(.text._ZN11xercesc_2_811PSVIHandlerD0Ev[xercesc_2_8::PSVIHandler::~PSVIHandler()]+0x1f): more undefined references to `operator delete(void*)' follow
/home/francis/tmp/cclsEcOL.o: In function `xercesc_2_8::XMLAttDefList::~XMLAttDefList()':
test.cc:(.text._ZN11xercesc_2_813XMLAttDefListD0Ev[xercesc_2_8::XMLAttDefList::~XMLAttDefList()]+0x2a): undefined reference to `xercesc_2_8::XMemory::operator delete(void*)'
/home/francis/tmp/cclsEcOL.o: In function `xercesc_2_8::XMLAttDefList::~XMLAttDefList()':
test.cc:(.text._ZN11xercesc_2_813XMLAttDefListD1Ev[xercesc_2_8::XMLAttDefList::~XMLAttDefList()]+0x2a): undefined reference to `xercesc_2_8::XMemory::operator delete(void*)'
/home/francis/tmp/cclsEcOL.o: In function `xercesc_2_8::PSVIItem::~PSVIItem()':
test.cc:(.text._ZN11xercesc_2_88PSVIItemD0Ev[xercesc_2_8::PSVIItem::~PSVIItem()]+0x1f): undefined reference to `xercesc_2_8::XMemory::operator delete(void*)'
/home/francis/tmp/cclsEcOL.o: In function `xercesc_2_8::PSVIItem::~PSVIItem()':
test.cc:(.text._ZN11xercesc_2_88PSVIItemD1Ev[xercesc_2_8::PSVIItem::~PSVIItem()]+0x1f): undefined reference to `xercesc_2_8::XMemory::operator delete(void*)'
/home/francis/tmp/cclsEcOL.o: In function `xercesc_2_8::PSVIItem::~PSVIItem()':
test.cc:(.text._ZN11xercesc_2_88PSVIItemD2Ev[xercesc_2_8::PSVIItem::~PSVIItem()]+0x1f): undefined reference to `xercesc_2_8::XMemory::operator delete(void*)'
/home/francis/tmp/cclsEcOL.o: In function `xercesc_2_8::DTDEntityDecl::~DTDEntityDecl()':
test.cc:(.text._ZN11xercesc_2_813DTDEntityDeclD0Ev[xercesc_2_8::DTDEntityDecl::~DTDEntityDecl()]+0x16): undefined reference to `xercesc_2_8::XMLEntityDecl::~XMLEntityDecl()'
test.cc:(.text._ZN11xercesc_2_813DTDEntityDeclD0Ev[xercesc_2_8::DTDEntityDecl::~DTDEntityDecl()]+0x2a): undefined reference to `xercesc_2_8::XMemory::operator delete(void*)'
/home/francis/tmp/cclsEcOL.o: In function `xercesc_2_8::DTDEntityDecl::~DTDEntityDecl()':
test.cc:(.text._ZN11xercesc_2_813DTDEntityDeclD1Ev[xercesc_2_8::DTDEntityDecl::~DTDEntityDecl()]+0x16): undefined reference to `xercesc_2_8::XMLEntityDecl::~XMLEntityDecl()'
test.cc:(.text._ZN11xercesc_2_813DTDEntityDeclD1Ev[xercesc_2_8::DTDEntityDecl::~DTDEntityDecl()]+0x2a): undefined reference to `xercesc_2_8::XMemory::operator delete(void*)'
/home/francis/tmp/cclsEcOL.o: In function `xercesc_2_8::PSVIAttribute::~PSVIAttribute()':
test.cc:(.text._ZN11xercesc_2_813PSVIAttributeD0Ev[xercesc_2_8::PSVIAttribute::~PSVIAttribute()]+0x7f): undefined reference to `xercesc_2_8::XMemory::operator delete(void*)'
/home/francis/tmp/cclsEcOL.o:(.gcc_except_table+0xa0): undefined reference to `typeinfo for xercesc_2_8::XMLException'
/home/francis/tmp/cclsEcOL.o:(.gcc_except_table+0xa4): undefined reference to `typeinfo for xercesc_2_8::DOMException'
/home/francis/tmp/cclsEcOL.o: In function `xercesc_2_8::PSVIAttribute::~PSVIAttribute()':
test.cc:(.text._ZN11xercesc_2_813PSVIAttributeD1Ev[xercesc_2_8::PSVIAttribute::~PSVIAttribute()]+0x7f): undefined reference to `xercesc_2_8::XMemory::operator delete(void*)'
/home/francis/tmp/cclsEcOL.o: In function `xercesc_2_8::HandlerBase::fatalError(xercesc_2_8::SAXParseException const&)':
test.cc:(.text._ZN11xercesc_2_811HandlerBase10fatalErrorERKNS_17SAXParseExceptionE[xercesc_2_8::HandlerBase::fatalError(xercesc_2_8::SAXParseException const&)]+0x16): undefined reference to `__cxa_allocate_exception'
test.cc:(.text._ZN11xercesc_2_811HandlerBase10fatalErrorERKNS_17SAXParseExceptionE[xercesc_2_8::HandlerBase::fatalError(xercesc_2_8::SAXParseException const&)]+0x2b): undefined reference to `xercesc_2_8::SAXParseException::SAXParseException(xercesc_2_8::SAXParseException const&)'
test.cc:(.text._ZN11xercesc_2_811HandlerBase10fatalErrorERKNS_17SAXParseExceptionE[xercesc_2_8::HandlerBase::fatalError(xercesc_2_8::SAXParseException const&)]+0x33): undefined reference to `xercesc_2_8::SAXParseException::~SAXParseException()'
test.cc:(.text._ZN11xercesc_2_811HandlerBase10fatalErrorERKNS_17SAXParseExceptionE[xercesc_2_8::HandlerBase::fatalError(xercesc_2_8::SAXParseException const&)]+0x3b): undefined reference to `typeinfo for xercesc_2_8::SAXParseException'
test.cc:(.text._ZN11xercesc_2_811HandlerBase10fatalErrorERKNS_17SAXParseExceptionE[xercesc_2_8::HandlerBase::fatalError(xercesc_2_8::SAXParseException const&)]+0x46): undefined reference to `__cxa_throw'
test.cc:(.text._ZN11xercesc_2_811HandlerBase10fatalErrorERKNS_17SAXParseExceptionE[xercesc_2_8::HandlerBase::fatalError(xercesc_2_8::SAXParseException const&)]+0x5e): undefined reference to `std::terminate()'
/home/francis/tmp/cclsEcOL.o:(.rodata._ZTVN11xercesc_2_811PSVIHandlerE[vtable for xercesc_2_8::PSVIHandler]+0x10): undefined reference to `__cxa_pure_virtual'
/home/francis/tmp/cclsEcOL.o:(.rodata._ZTVN11xercesc_2_811PSVIHandlerE[vtable for xercesc_2_8::PSVIHandler]+0x18): undefined reference to `__cxa_pure_virtual'
/home/francis/tmp/cclsEcOL.o:(.rodata._ZTVN11xercesc_2_813PSVIAttributeE[vtable for xercesc_2_8::PSVIAttribute]+0x18): undefined reference to `xercesc_2_8::PSVIItem::getActualValue() const'
/home/francis/tmp/cclsEcOL.o:(.rodata._ZTVN11xercesc_2_88PSVIItemE[vtable for xercesc_2_8::PSVIItem]+0x10): undefined reference to `__cxa_pure_virtual'
/home/francis/tmp/cclsEcOL.o:(.rodata._ZTVN11xercesc_2_88PSVIItemE[vtable for xercesc_2_8::PSVIItem]+0x14): undefined reference to `__cxa_pure_virtual'
/home/francis/tmp/cclsEcOL.o:(.rodata._ZTVN11xercesc_2_88PSVIItemE[vtable for xercesc_2_8::PSVIItem]+0x18): undefined reference to `xercesc_2_8::PSVIItem::getActualValue() const'
/home/francis/tmp/cclsEcOL.o:(.rodata._ZTVN11xercesc_2_813DTDEntityDeclE[vtable for xercesc_2_8::DTDEntityDecl]+0x10): undefined reference to `xercesc_2_8::DTDEntityDecl::isSerializable() const'
/home/francis/tmp/cclsEcOL.o:(.rodata._ZTVN11xercesc_2_813DTDEntityDeclE[vtable for xercesc_2_8::DTDEntityDecl]+0x14): undefined reference to `xercesc_2_8::DTDEntityDecl::serialize(xercesc_2_8::XSerializeEngine&)'
/home/francis/tmp/cclsEcOL.o:(.rodata._ZTVN11xercesc_2_813DTDEntityDeclE[vtable for xercesc_2_8::DTDEntityDecl]+0x18): undefined reference to `xercesc_2_8::DTDEntityDecl::getProtoType() const'
/home/francis/tmp/cclsEcOL.o:(.rodata._ZTVN11xercesc_2_813XMLAttDefListE[vtable for xercesc_2_8::XMLAttDefList]+0x10): undefined reference to `xercesc_2_8::XMLAttDefList::isSerializable() const'
/home/francis/tmp/cclsEcOL.o:(.rodata._ZTVN11xercesc_2_813XMLAttDefListE[vtable for xercesc_2_8::XMLAttDefList]+0x14): undefined reference to `xercesc_2_8::XMLAttDefList::serialize(xercesc_2_8::XSerializeEngine&)'
/home/francis/tmp/cclsEcOL.o:(.rodata._ZTVN11xercesc_2_813XMLAttDefListE[vtable for xercesc_2_8::XMLAttDefList]+0x18): undefined reference to `xercesc_2_8::XMLAttDefList::getProtoType() const'
/home/francis/tmp/cclsEcOL.o:(.rodata._ZTVN11xercesc_2_813XMLAttDefListE[vtable for xercesc_2_8::XMLAttDefList]+0x1c): undefined reference to `__cxa_pure_virtual'
/home/francis/tmp/cclsEcOL.o:(.rodata._ZTVN11xercesc_2_813XMLAttDefListE[vtable for xercesc_2_8::XMLAttDefList]+0x20): undefined reference to `__cxa_pure_virtual'
/home/francis/tmp/cclsEcOL.o:(.rodata._ZTVN11xercesc_2_813XMLAttDefListE[vtable for xercesc_2_8::XMLAttDefList]+0x24): undefined reference to `__cxa_pure_virtual'
/home/francis/tmp/cclsEcOL.o:(.rodata._ZTVN11xercesc_2_813XMLAttDefListE[vtable for xercesc_2_8::XMLAttDefList]+0x28): undefined reference to `__cxa_pure_virtual'
/home/francis/tmp/cclsEcOL.o:(.rodata._ZTVN11xercesc_2_813XMLAttDefListE[vtable for xercesc_2_8::XMLAttDefList]+0x2c): undefined reference to `__cxa_pure_virtual'
/home/francis/tmp/cclsEcOL.o:(.rodata._ZTVN11xercesc_2_813XMLAttDefListE[vtable for xercesc_2_8::XMLAttDefList]+0x30): more undefined references to `__cxa_pure_virtual' follow
/home/francis/tmp/cclsEcOL.o:(.rodata._ZTIN11xercesc_2_811HandlerBaseE[typeinfo for xercesc_2_8::HandlerBase]+0x0): undefined reference to `vtable for __cxxabiv1::__vmi_class_type_info'
/home/francis/tmp/cclsEcOL.o:(.rodata._ZTIN11xercesc_2_811PSVIHandlerE[typeinfo for xercesc_2_8::PSVIHandler]+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info'
/home/francis/tmp/cclsEcOL.o:(.rodata._ZTIN11xercesc_2_813PSVIAttributeE[typeinfo for xercesc_2_8::PSVIAttribute]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
/home/francis/tmp/cclsEcOL.o:(.rodata._ZTIN11xercesc_2_88PSVIItemE[typeinfo for xercesc_2_8::PSVIItem]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
/home/francis/tmp/cclsEcOL.o:(.rodata._ZTIN11xercesc_2_813DTDEntityDeclE[typeinfo for xercesc_2_8::DTDEntityDecl]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
/home/francis/tmp/cclsEcOL.o:(.rodata._ZTIN11xercesc_2_813DTDEntityDeclE[typeinfo for xercesc_2_8::DTDEntityDecl]+0x8): undefined reference to `typeinfo for xercesc_2_8::XMLEntityDecl'
/home/francis/tmp/cclsEcOL.o:(.rodata._ZTIN11xercesc_2_813XMLAttDefListE[typeinfo for xercesc_2_8::XMLAttDefList]+0x0): undefined reference to `vtable for __cxxabiv1::__vmi_class_type_info'
/home/francis/tmp/cclsEcOL.o:(.rodata._ZTIN11xercesc_2_810XMLDeleterE[typeinfo for xercesc_2_8::XMLDeleter]+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info'
/home/francis/tmp/cclsEcOL.o:(.rodata._ZTIN11xercesc_2_814EntityResolverE[typeinfo for xercesc_2_8::EntityResolver]+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info'
/home/francis/tmp/cclsEcOL.o:(.rodata._ZTIN11xercesc_2_810DTDHandlerE[typeinfo for xercesc_2_8::DTDHandler]+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info'
/home/francis/tmp/cclsEcOL.o:(.rodata._ZTIN11xercesc_2_815DocumentHandlerE[typeinfo for xercesc_2_8::DocumentHandler]+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info'
/home/francis/tmp/cclsEcOL.o:(.rodata._ZTIN11xercesc_2_812ErrorHandlerE[typeinfo for xercesc_2_8::ErrorHandler]+0x0): undefined reference to`vtable for __cxxabiv1::__class_type_info'
/home/francis/tmp/cclsEcOL.o:(.rodata._ZTIN11xercesc_2_87XMemoryE[typeinfo for xercesc_2_8::XMemory]+0x0): more undefined references to `vtable for __cxxabiv1::__class_type_info' follow
/home/francis/tmp/cclsEcOL.o:(.rodata._ZTVN11xercesc_2_813XSerializableE[vtable for xercesc_2_8::XSerializable]+0x10): undefined reference to `__cxa_pure_virtual'
/home/francis/tmp/cclsEcOL.o:(.rodata._ZTVN11xercesc_2_813XSerializableE[vtable for xercesc_2_8::XSerializable]+0x14): undefined reference to `__cxa_pure_virtual'
/home/francis/tmp/cclsEcOL.o:(.rodata._ZTVN11xercesc_2_813XSerializableE[vtable for xercesc_2_8::XSerializable]+0x18): undefined reference to `__cxa_pure_virtual'
/home/francis/tmp/cclsEcOL.o:(.rodata._ZTVN11xercesc_2_812ErrorHandlerE[vtable for xercesc_2_8::ErrorHandler]+0x10): undefined reference to `__cxa_pure_virtual'
/home/francis/tmp/cclsEcOL.o:(.rodata._ZTVN11xercesc_2_812ErrorHandlerE[vtable for xercesc_2_8::ErrorHandler]+0x14): undefined reference to `__cxa_pure_virtual'
/home/francis/tmp/cclsEcOL.o:(.rodata._ZTVN11xercesc_2_812ErrorHandlerE[vtable for xercesc_2_8::ErrorHandler]+0x18): more undefined references to `__cxa_pure_virtual' follow
/home/francis/tmp/cclsEcOL.o:(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
collect2: ld a retourné 1 code d'état d'exécution
[francis@localhost Bureau]$

Je ne sais pas ce qui ce passe. S'il vous plaît aider moi; Merci d'avance et surtout excusez moi pour la longueur

1 réponse

Goupfrancis
Messages postés
21
Date d'inscription
mercredi 24 octobre 2007
Statut
Membre
Dernière intervention
2 avril 2009

26 févr. 2009 à 02:03
Bonjour, je suis débutant sur l'utilisation de Dom et de l'API xerces en c++ sous linux, j'ai installé les librairies lixerces-c-devel, lixercesc-0,lixerces-c28 sous mon mandriva free 2009; j'essaie d'éxécuter le code(fichier test.cc) suivant: pour creer un parser:

#include <xercesc/parsers/XercesDOMParser.hpp>
#include <xercesc/dom/DOM.hpp>
#include <xercesc/sax/HandlerBase.hpp>
#include <xercesc/util/XMLString.hpp>
#include <xercesc/util/PlatformUtils.hpp>
#include <iostream>

using namespace std;
using namespace xercesc;

int main (int argc, char* args[]) {

try {
XMLPlatformUtils::Initialize();
}
catch (const XMLException& toCatch) {
char* message = XMLString::transcode(toCatch.getMessage());
cout << "Error during initialization! :\n"
<< message << "\n";
XMLString::release(&message);
return 1;
}

XercesDOMParser* parser = new XercesDOMParser();
parser->setValidationScheme(XercesDOMParser::Val_Always);
parser->setDoNamespaces(true); // optional

ErrorHandler* errHandler = (ErrorHandler*) new HandlerBase();
parser->setErrorHandler(errHandler);

char* xmlFile = "/home/francis/Bureau/schema.xml";

try {
parser->parse(xmlFile);
}
catch (const XMLException& toCatch) {
char* message = XMLString::transcode(toCatch.getMessage());
cout << "Exception message is: \n"
<< message << "\n";
XMLString::release(&message);
return -1;
}
catch (const DOMException& toCatch) {
char* message = XMLString::transcode(toCatch.msg);
cout << "Exception message is: \n"
<< message << "\n";
XMLString::release(&message);
return -1;
}
catch (...) {
cout << "Unexpected Exception \n" ;
return -1;
}

delete parser;
delete errHandler;
return 0;
}



voici ce que j'obtiens:

[francis@localhost Bureau]$ g++ -o test test.cc
test.cc: In function ‘int main(int, char**)’:
test.cc:31: attention : deprecated conversion from string constant to ‘char*’
/home/francis/tmp/cc0WVmmq.o: In function `main':
test.cc:(.text+0x92): undefined reference to `xercesc_2_8::XMLUni::fgXercescDefaultLocale'
test.cc:(.text+0x97): undefined reference to `xercesc_2_8::XMLPlatformUtils::Initialize(char const*, char const*, xercesc_2_8::PanicHandler*, xercesc_2_8::MemoryManager*, bool)'
test.cc:(.text+0xa3): undefined reference to `xercesc_2_8::XMemory::operator new(unsigned int)'
test.cc:(.text+0xab): undefined reference to `xercesc_2_8::XMLPlatformUtils::fgMemoryManager'
test.cc:(.text+0xca): undefined reference to `xercesc_2_8::XercesDOMParser::XercesDOMParser(xercesc_2_8::XMLValidator*, xercesc_2_8::MemoryManager*, xercesc_2_8::XMLGrammarPool*)'
test.cc:(.text+0x107): undefined reference to `xercesc_2_8::XMLString::transcode(unsigned short const*)'
test.cc:(.text+0x14e): undefined reference to `xercesc_2_8::XMLString::release(char**)'
test.cc:(.text+0x19a): undefined reference to `xercesc_2_8::AbstractDOMParser::setValidationScheme(xercesc_2_8::AbstractDOMParser::ValSchemes)'
test.cc:(.text+0x1ad): undefined reference to `xercesc_2_8::AbstractDOMParser::setDoNamespaces(bool)'
test.cc:(.text+0x1e5): undefined reference to `xercesc_2_8::XMemory::operator delete(void*)'
test.cc:(.text+0x220): undefined reference to `xercesc_2_8::XercesDOMParser::setErrorHandler(xercesc_2_8::ErrorHandler*)'
test.cc:(.text+0x239): undefined reference to `xercesc_2_8::AbstractDOMParser::parse(char const*)'
test.cc:(.text+0x284): undefined reference to `xercesc_2_8::XMLString::transcode(unsigned short const*)'
test.cc:(.text+0x2cb): undefined reference to `xercesc_2_8::XMLString::release(char**)'
test.cc:(.text+0x31a): undefined reference to `xercesc_2_8::XMLString::transcode(unsigned short const*)'
test.cc:(.text+0x361): undefined reference to `xercesc_2_8::XMLString::release(char**)'
/home/francis/tmp/cc0WVmmq.o: In function `xercesc_2_8::XMLAttDefList::~XMLAttDefList()':
test.cc:(.text._ZN11xercesc_2_813XMLAttDefListD0Ev[xercesc_2_8::XMLAttDefList::~XMLAttDefList()]+0x2a): undefined reference to `xercesc_2_8::XMemory::operator delete(void*)'
/home/francis/tmp/cc0WVmmq.o: In function `xercesc_2_8::XMLAttDefList::~XMLAttDefList()':
test.cc:(.text._ZN11xercesc_2_813XMLAttDefListD1Ev[xercesc_2_8::XMLAttDefList::~XMLAttDefList()]+0x2a): undefined reference to `xercesc_2_8::XMemory::operator delete(void*)'
/home/francis/tmp/cc0WVmmq.o: In function `xercesc_2_8::PSVIItem::~PSVIItem()':
test.cc:(.text._ZN11xercesc_2_88PSVIItemD0Ev[xercesc_2_8::PSVIItem::~PSVIItem()]+0x1f): undefined reference to `xercesc_2_8::XMemory::operator delete(void*)'
/home/francis/tmp/cc0WVmmq.o: In function `xercesc_2_8::PSVIItem::~PSVIItem()':
test.cc:(.text._ZN11xercesc_2_88PSVIItemD1Ev[xercesc_2_8::PSVIItem::~PSVIItem()]+0x1f): undefined reference to `xercesc_2_8::XMemory::operator delete(void*)'
/home/francis/tmp/cc0WVmmq.o: In function `xercesc_2_8::PSVIItem::~PSVIItem()':
test.cc:(.text._ZN11xercesc_2_88PSVIItemD2Ev[xercesc_2_8::PSVIItem::~PSVIItem()]+0x1f): undefined reference to `xercesc_2_8::XMemory::operator delete(void*)'
/home/francis/tmp/cc0WVmmq.o: In function `xercesc_2_8::DTDEntityDecl::~DTDEntityDecl()':
test.cc:(.text._ZN11xercesc_2_813DTDEntityDeclD0Ev[xercesc_2_8::DTDEntityDecl::~DTDEntityDecl()]+0x16): undefined reference to `xercesc_2_8::XMLEntityDecl::~XMLEntityDecl()'
test.cc:(.text._ZN11xercesc_2_813DTDEntityDeclD0Ev[xercesc_2_8::DTDEntityDecl::~DTDEntityDecl()]+0x2a): undefined reference to `xercesc_2_8::XMemory::operator delete(void*)'
/home/francis/tmp/cc0WVmmq.o: In function `xercesc_2_8::DTDEntityDecl::~DTDEntityDecl()':
test.cc:(.text._ZN11xercesc_2_813DTDEntityDeclD1Ev[xercesc_2_8::DTDEntityDecl::~DTDEntityDecl()]+0x16): undefined reference to `xercesc_2_8::XMLEntityDecl::~XMLEntityDecl()'
test.cc:(.text._ZN11xercesc_2_813DTDEntityDeclD1Ev[xercesc_2_8::DTDEntityDecl::~DTDEntityDecl()]+0x2a): undefined reference to `xercesc_2_8::XMemory::operator delete(void*)'
/home/francis/tmp/cc0WVmmq.o: In function `xercesc_2_8::PSVIAttribute::~PSVIAttribute()':
test.cc:(.text._ZN11xercesc_2_813PSVIAttributeD0Ev[xercesc_2_8::PSVIAttribute::~PSVIAttribute()]+0x7f): undefined reference to `xercesc_2_8::XMemory::operator delete(void*)'
/home/francis/tmp/cc0WVmmq.o:(.gcc_except_table+0xa0): undefined reference to `typeinfo for xercesc_2_8::XMLException'
/home/francis/tmp/cc0WVmmq.o:(.gcc_except_table+0xa4): undefined reference to `typeinfo for xercesc_2_8::DOMException'
/home/francis/tmp/cc0WVmmq.o: In function `xercesc_2_8::PSVIAttribute::~PSVIAttribute()':
test.cc:(.text._ZN11xercesc_2_813PSVIAttributeD1Ev[xercesc_2_8::PSVIAttribute::~PSVIAttribute()]+0x7f): undefined reference to `xercesc_2_8::XMemory::operator delete(void*)'
/home/francis/tmp/cc0WVmmq.o: In function `xercesc_2_8::HandlerBase::fatalError(xercesc_2_8::SAXParseException const&)':
test.cc:(.text._ZN11xercesc_2_811HandlerBase10fatalErrorERKNS_17SAXParseExceptionE[xercesc_2_8::HandlerBase::fatalError(xercesc_2_8::SAXParseException const&)]+0x2b): undefined reference to `xercesc_2_8::SAXParseException::SAXParseException(xercesc_2_8::SAXParseException const&)'
test.cc:(.text._ZN11xercesc_2_811HandlerBase10fatalErrorERKNS_17SAXParseExceptionE[xercesc_2_8::HandlerBase::fatalError(xercesc_2_8::SAXParseException const&)]+0x33): undefined reference to `xercesc_2_8::SAXParseException::~SAXParseException()'
test.cc:(.text._ZN11xercesc_2_811HandlerBase10fatalErrorERKNS_17SAXParseExceptionE[xercesc_2_8::HandlerBase::fatalError(xercesc_2_8::SAXParseException const&)]+0x3b): undefined reference to `typeinfo for xercesc_2_8::SAXParseException'
/home/francis/tmp/cc0WVmmq.o:(.rodata._ZTVN11xercesc_2_813PSVIAttributeE[vtablefor xercesc_2_8::PSVIAttribute]+0x18): undefined reference to `xercesc_2_8::PSVIItem::getActualValue() const'
/home/francis/tmp/cc0WVmmq.o:(.rodata._ZTVN11xercesc_2_88PSVIItemE[vtable for xercesc_2_8::PSVIItem]+0x18): undefined reference to `xercesc_2_8::PSVIItem::getActualValue() const'
/home/francis/tmp/cc0WVmmq.o:(.rodata._ZTVN11xercesc_2_813DTDEntityDeclE[vtablefor xercesc_2_8::DTDEntityDecl]+0x10): undefined reference to `xercesc_2_8::DTDEntityDecl::isSerializable() const'
/home/francis/tmp/cc0WVmmq.o:(.rodata._ZTVN11xercesc_2_813DTDEntityDeclE[vtablefor xercesc_2_8::DTDEntityDecl]+0x14): undefined reference to `xercesc_2_8::DTDEntityDecl::serialize(xercesc_2_8::XSerializeEngine&)'
/home/francis/tmp/cc0WVmmq.o:(.rodata._ZTVN11xercesc_2_813DTDEntityDeclE[vtablefor xercesc_2_8::DTDEntityDecl]+0x18): undefined reference to `xercesc_2_8::DTDEntityDecl::getProtoType() const'
/home/francis/tmp/cc0WVmmq.o:(.rodata._ZTVN11xercesc_2_813XMLAttDefListE[vtablefor xercesc_2_8::XMLAttDefList]+0x10): undefined reference to `xercesc_2_8::XMLAttDefList::isSerializable() const'
/home/francis/tmp/cc0WVmmq.o:(.rodata._ZTVN11xercesc_2_813XMLAttDefListE[vtablefor xercesc_2_8::XMLAttDefList]+0x14): undefined reference to `xercesc_2_8::XMLAttDefList::serialize(xercesc_2_8::XSerializeEngine&)'
/home/francis/tmp/cc0WVmmq.o:(.rodata._ZTVN11xercesc_2_813XMLAttDefListE[vtablefor xercesc_2_8::XMLAttDefList]+0x18): undefined reference to `xercesc_2_8::XMLAttDefList::getProtoType() const'
/home/francis/tmp/cc0WVmmq.o:(.rodata._ZTIN11xercesc_2_813DTDEntityDeclE[typeinfo for xercesc_2_8::DTDEntityDecl]+0x8): undefined reference to `typeinfo for xercesc_2_8::XMLEntityDecl'
collect2: ld a retourné 1 code d'état d'exécution
[francis@localhost Bureau]$

je ne sais quel est le problème, aidez moi s'il vs plaît.
0