IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

XML Discussion :

[Xerces] Problème d'installation / inclusion


Sujet :

XML

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre habitué
    Inscrit en
    Janvier 2010
    Messages
    8
    Détails du profil
    Informations forums :
    Inscription : Janvier 2010
    Messages : 8
    Par défaut [Xerces] Problème d'installation / inclusion
    Bonjour,
    Je n'arrive pas à utiliser Xerces 3.0.1

    J'essaie de compiler le code donné en exemple suivant :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
     
    #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>
     
    #if defined(XERCES_NEW_IOSTREAMS)
    #include <iostream>
    #else
    #include <iostream.h>
    #endif
     
    XERCES_CPP_NAMESPACE_USE
    using namespace std;
     
    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 = "exemple.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;
    }
    J'ai essayé avec les source, en les compilant, avec les binaires. Rien.
    Pour l'instant j'ai donc l'archive xerces-c-3.0.1-x86-linux-gcc-3.4
    et le répertoire correspondant.
    Je suis la procédure pour les export :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    echo $PATH
    /home/archfiend/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/archfiend/xerces-c-3.0.1-x86-linux-gcc-3.4/bin
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    echo $LD_LIBRARY_PATH/home/archfiend/xerces-c-3.0.1-x86-linux-gcc-3.4/lib
    Je lance la compilation dans le même terminal :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
     
    g++ main.cpp
    main.cpp: In function ‘int main(int, char**)’:
    main.cpp:36: attention : deprecated conversion from string constant to ‘char*’
    /tmp/cczLqLZc.o: In function `main':
    main.cpp:(.text+0x92): undefined reference to `xercesc_2_8::XMLUni::fgXercescDefaultLocale'
    main.cpp:(.text+0x97): undefined reference to `xercesc_2_8::XMLPlatformUtils::Initialize(char const*, char const*, xercesc_2_8::PanicHandler*, xercesc_2_8::MemoryManager*, bool)'
    main.cpp:(.text+0xa3): undefined reference to `xercesc_2_8::XMemory::operator new(unsigned int)'
    main.cpp:(.text+0xab): undefined reference to `xercesc_2_8::XMLPlatformUtils::fgMemoryManager'
    main.cpp:(.text+0xca): undefined reference to `xercesc_2_8::XercesDOMParser::XercesDOMParser(xercesc_2_8::XMLValidator*, xercesc_2_8::MemoryManager*, xercesc_2_8::XMLGrammarPool*)'
    main.cpp:(.text+0x107): undefined reference to `xercesc_2_8::XMLString::transcode(unsigned short const*)'
    main.cpp:(.text+0x14e): undefined reference to `xercesc_2_8::XMLString::release(char**)'
    main.cpp:(.text+0x19a): undefined reference to `xercesc_2_8::AbstractDOMParser::setValidationScheme(xercesc_2_8::AbstractDOMParser::ValSchemes)'
    main.cpp:(.text+0x1ad): undefined reference to `xercesc_2_8::AbstractDOMParser::setDoNamespaces(bool)'
    main.cpp:(.text+0x1e5): undefined reference to `xercesc_2_8::XMemory::operator delete(void*)'
    main.cpp:(.text+0x220): undefined reference to `xercesc_2_8::XercesDOMParser::setErrorHandler(xercesc_2_8::ErrorHandler*)'
    main.cpp:(.text+0x239): undefined reference to `xercesc_2_8::AbstractDOMParser::parse(char const*)'
    main.cpp:(.text+0x284): undefined reference to `xercesc_2_8::XMLString::transcode(unsigned short const*)'
    main.cpp:(.text+0x2cb): undefined reference to `xercesc_2_8::XMLString::release(char**)'
    main.cpp:(.text+0x31a): undefined reference to `xercesc_2_8::XMLString::transcode(unsigned short const*)'
    main.cpp:(.text+0x361): undefined reference to `xercesc_2_8::XMLString::release(char**)'
    /tmp/cczLqLZc.o: In function `xercesc_2_8::XMLAttDefList::~XMLAttDefList()':
    main.cpp:(.text._ZN11xercesc_2_813XMLAttDefListD0Ev[xercesc_2_8::XMLAttDefList::~XMLAttDefList()]+0x2a): undefined reference to `xercesc_2_8::XMemory::operator delete(void*)'
    /tmp/cczLqLZc.o: In function `xercesc_2_8::XMLAttDefList::~XMLAttDefList()':
    main.cpp:(.text._ZN11xercesc_2_813XMLAttDefListD1Ev[xercesc_2_8::XMLAttDefList::~XMLAttDefList()]+0x2a): undefined reference to `xercesc_2_8::XMemory::operator delete(void*)'
    /tmp/cczLqLZc.o: In function `xercesc_2_8::PSVIItem::~PSVIItem()':
    main.cpp:(.text._ZN11xercesc_2_88PSVIItemD0Ev[xercesc_2_8::PSVIItem::~PSVIItem()]+0x1f): undefined reference to `xercesc_2_8::XMemory::operator delete(void*)'
    /tmp/cczLqLZc.o: In function `xercesc_2_8::PSVIItem::~PSVIItem()':
    main.cpp:(.text._ZN11xercesc_2_88PSVIItemD1Ev[xercesc_2_8::PSVIItem::~PSVIItem()]+0x1f): undefined reference to `xercesc_2_8::XMemory::operator delete(void*)'
    /tmp/cczLqLZc.o: In function `xercesc_2_8::PSVIItem::~PSVIItem()':
    main.cpp:(.text._ZN11xercesc_2_88PSVIItemD2Ev[xercesc_2_8::PSVIItem::~PSVIItem()]+0x1f): undefined reference to `xercesc_2_8::XMemory::operator delete(void*)'
    /tmp/cczLqLZc.o: In function `xercesc_2_8::DTDEntityDecl::~DTDEntityDecl()':
    main.cpp:(.text._ZN11xercesc_2_813DTDEntityDeclD0Ev[xercesc_2_8::DTDEntityDecl::~DTDEntityDecl()]+0x16): undefined reference to `xercesc_2_8::XMLEntityDecl::~XMLEntityDecl()'
    main.cpp:(.text._ZN11xercesc_2_813DTDEntityDeclD0Ev[xercesc_2_8::DTDEntityDecl::~DTDEntityDecl()]+0x2a): undefined reference to `xercesc_2_8::XMemory::operator delete(void*)'
    /tmp/cczLqLZc.o: In function `xercesc_2_8::DTDEntityDecl::~DTDEntityDecl()':
    main.cpp:(.text._ZN11xercesc_2_813DTDEntityDeclD1Ev[xercesc_2_8::DTDEntityDecl::~DTDEntityDecl()]+0x16): undefined reference to `xercesc_2_8::XMLEntityDecl::~XMLEntityDecl()'
    main.cpp:(.text._ZN11xercesc_2_813DTDEntityDeclD1Ev[xercesc_2_8::DTDEntityDecl::~DTDEntityDecl()]+0x2a): undefined reference to `xercesc_2_8::XMemory::operator delete(void*)'
    /tmp/cczLqLZc.o: In function `xercesc_2_8::PSVIAttribute::~PSVIAttribute()':
    main.cpp:(.text._ZN11xercesc_2_813PSVIAttributeD0Ev[xercesc_2_8::PSVIAttribute::~PSVIAttribute()]+0x7f): undefined reference to `xercesc_2_8::XMemory::operator delete(void*)'
    /tmp/cczLqLZc.o:(.gcc_except_table+0xa0): undefined reference to `typeinfo for xercesc_2_8::XMLException'
    /tmp/cczLqLZc.o:(.gcc_except_table+0xa4): undefined reference to `typeinfo for xercesc_2_8::DOMException'
    /tmp/cczLqLZc.o: In function `xercesc_2_8::PSVIAttribute::~PSVIAttribute()':
    main.cpp:(.text._ZN11xercesc_2_813PSVIAttributeD1Ev[xercesc_2_8::PSVIAttribute::~PSVIAttribute()]+0x7f): undefined reference to `xercesc_2_8::XMemory::operator delete(void*)'
    /tmp/cczLqLZc.o: In function `xercesc_2_8::HandlerBase::fatalError(xercesc_2_8::SAXParseException const&)':
    main.cpp:(.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&)'
    main.cpp:(.text._ZN11xercesc_2_811HandlerBase10fatalErrorERKNS_17SAXParseExceptionE[xercesc_2_8::HandlerBase::fatalError(xercesc_2_8::SAXParseException const&)]+0x33): undefined reference to `xercesc_2_8::SAXParseException::~SAXParseException()'
    main.cpp:(.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'
    /tmp/cczLqLZc.o:(.rodata._ZTVN11xercesc_2_813PSVIAttributeE[vtable for xercesc_2_8::PSVIAttribute]+0x18): undefined reference to `xercesc_2_8::PSVIItem::getActualValue() const'
    /tmp/cczLqLZc.o:(.rodata._ZTVN11xercesc_2_88PSVIItemE[vtable for xercesc_2_8::PSVIItem]+0x18): undefined reference to `xercesc_2_8::PSVIItem::getActualValue() const'
    /tmp/cczLqLZc.o:(.rodata._ZTVN11xercesc_2_813DTDEntityDeclE[vtable for xercesc_2_8::DTDEntityDecl]+0x10): undefined reference to `xercesc_2_8::DTDEntityDecl::isSerializable() const'
    /tmp/cczLqLZc.o:(.rodata._ZTVN11xercesc_2_813DTDEntityDeclE[vtable for xercesc_2_8::DTDEntityDecl]+0x14): undefined reference to `xercesc_2_8::DTDEntityDecl::serialize(xercesc_2_8::XSerializeEngine&)'
    /tmp/cczLqLZc.o:(.rodata._ZTVN11xercesc_2_813DTDEntityDeclE[vtable for xercesc_2_8::DTDEntityDecl]+0x18): undefined reference to `xercesc_2_8::DTDEntityDecl::getProtoType() const'
    /tmp/cczLqLZc.o:(.rodata._ZTVN11xercesc_2_813XMLAttDefListE[vtable for xercesc_2_8::XMLAttDefList]+0x10): undefined reference to `xercesc_2_8::XMLAttDefList::isSerializable() const'
    /tmp/cczLqLZc.o:(.rodata._ZTVN11xercesc_2_813XMLAttDefListE[vtable for xercesc_2_8::XMLAttDefList]+0x14): undefined reference to `xercesc_2_8::XMLAttDefList::serialize(xercesc_2_8::XSerializeEngine&)'
    /tmp/cczLqLZc.o:(.rodata._ZTVN11xercesc_2_813XMLAttDefListE[vtable for xercesc_2_8::XMLAttDefList]+0x18): undefined reference to `xercesc_2_8::XMLAttDefList::getProtoType() const'
    /tmp/cczLqLZc.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
    Comment remédier à ce problème svp ?

  2. #2
    Membre habitué
    Inscrit en
    Janvier 2010
    Messages
    8
    Détails du profil
    Informations forums :
    Inscription : Janvier 2010
    Messages : 8
    Par défaut
    Oublié de préciser que j'étais sous ubunut 8.04.

    J'ai un peu avancé dans mon problème.

    Il restait un dossier xercesc dans /usr/local/include

    Apres suppression j'obtient :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    g++ main.cpp
    main.cpp:1:42: erreur: xercesc/util/PlatformUtils.hpp : Aucun fichier ou dossier de ce type
    main.cpp:4: erreur: ‘xercesc’ is not a namespace-name
    main.cpp:4: erreur: expected namespace-name before ‘;’ token
    main.cpp: In function ‘int main(int, char**)’:
    main.cpp:9: erreur: ‘XMLPlatformUtils’ has not been declared
    main.cpp:11: erreur: ISO C++ forbids declaration of ‘XMLException’ with no type
    main.cpp:11: erreur: expected `)' before ‘&’ token
    main.cpp:11: erreur: expected `{' before ‘&’ token
    main.cpp:11: erreur: ‘toCatch’ was not declared in this scope
    main.cpp:11: erreur: expected `;' before ‘)’ token
    main.cpp:18: erreur: ‘XMLPlatformUtils’ has not been declared
    Normal, y'a plus xerces.

    Je refais les export dans les variable d'environnement et je recompile, même erreure :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    g++ main.cppmain.cpp:1:42: erreur: xercesc/util/PlatformUtils.hpp : Aucun fichier ou dossier de ce type
    main.cpp:4: erreur: ‘xercesc’ is not a namespace-name
    main.cpp:4: erreur: expected namespace-name before ‘;’ token
    main.cpp: In function ‘int main(int, char**)’:
    main.cpp:9: erreur: ‘XMLPlatformUtils’ has not been declared
    main.cpp:11: erreur: ISO C++ forbids declaration of ‘XMLException’ with no type
    main.cpp:11: erreur: expected `)' before ‘&’ token
    main.cpp:11: erreur: expected `{' before ‘&’ token
    main.cpp:11: erreur: ‘toCatch’ was not declared in this scope
    main.cpp:11: erreur: expected `;' before ‘)’ token
    main.cpp:18: erreur: ‘XMLPlatformUtils’ has not been declared
    Je recompile avec -I le repertoire d'nclude dans le dossier de xercesc :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    g++ main.cpp -I /home/archfiend/xerces-c-3.0.1-x86-linux-gcc-3.4/include/
    /tmp/cc21xf9w.o: In function `main':
    main.cpp:(.text+0x2c): undefined reference to `xercesc_3_0::XMLUni::fgXercescDefaultLocale'
    main.cpp:(.text+0x31): undefined reference to `xercesc_3_0::XMLPlatformUtils::Initialize(char const*, char const*, xercesc_3_0::PanicHandler*, xercesc_3_0::MemoryManager*)'
    main.cpp:(.text+0x36): undefined reference to `xercesc_3_0::XMLPlatformUtils::Terminate()'
    /tmp/cc21xf9w.o:(.gcc_except_table+0x10): undefined reference to `typeinfo for xercesc_3_0::XMLException'
    collect2: ld a retourné 1 code d'état d'exécution
    C'est mieux puisqu'au moins c'est xercesc_3_0 qui apparait dans les messages d'erreures, mais je sais pas plus comment régler cela.

    Edit// Finalement réussi, il faut -I, -L -l xerces-c:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    g++ -o parser main.cpp -I /home/archfiend/xerces-c-3.0.1-x86-linux-gcc-3.4/include/ -L /home/archfiend/xerces-c-3.0.1-x86-linux-gcc-3.4/lib/ -l xerces-c

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Problème d'installation de CallerId
    Par Chacks dans le forum Composants VCL
    Réponses: 5
    Dernier message: 21/08/2003, 08h30
  2. problème d'installation du compilateur Borland C++
    Par Hakkou dans le forum Autres éditeurs
    Réponses: 1
    Dernier message: 02/06/2003, 11h02
  3. [SAPdb]Problème d'installation
    Par manou dans le forum SAP
    Réponses: 3
    Dernier message: 17/04/2003, 09h20
  4. Problème d'installation oracle 8.1.7 sous NT
    Par Anonymous dans le forum Installation
    Réponses: 7
    Dernier message: 02/08/2002, 14h18
  5. Réponses: 3
    Dernier message: 26/07/2002, 23h02

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo