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 :

[TinyXML] Compilation


Sujet :

XML

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre averti
    Inscrit en
    Mars 2007
    Messages
    25
    Détails du profil
    Informations forums :
    Inscription : Mars 2007
    Messages : 25
    Par défaut [TinyXML] Compilation
    Bonjour,

    Je voudrais pouvoir utiliser TinyXML, mais je n'arrive pas à compiler mon programme. Apparemment il faut également compiler TinyXML. Voici comment je procède (sous linux):

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
     
    $ g++ -o tinystr.o -c tinystr.cpp 
    $ g++ -o tinyxmlparser.o -c tinyxmlparser.cpp 
    $ g++ -o tinyxmlerror.o -c tinyxmlerror.cpp 
    $ g++ -o main.o -c main.cpp 
    $ $ g++ main.o tinystr.o tinyxmlparser.o tinyxmlerror.o -o main -lboost_date_time
    Mais la dernière commande me renvoit:
    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
    tinyxmlparser.o: In function `TiXmlBase::ReadText(char const*, TiXmlString*, bool, char const*, bool, TiXmlEncoding)':
    tinyxmlparser.cpp:(.text+0xd06): undefined reference to `TiXmlBase::condenseWhiteSpace'
    tinyxmlparser.o: In function `TiXmlNode::Identify(char const*, TiXmlEncoding)':
    tinyxmlparser.cpp:(.text+0x15ef): undefined reference to `TiXmlElement::TiXmlElement(char const*)'
    tinyxmlparser.o: In function `TiXmlElement::ReadValue(char const*, TiXmlParsingData*, TiXmlEncoding)':
    tinyxmlparser.cpp:(.text+0x17f9): undefined reference to `TiXmlNode::LinkEndChild(TiXmlNode*)'
    tinyxmlparser.cpp:(.text+0x18ae): undefined reference to `TiXmlNode::LinkEndChild(TiXmlNode*)'
    tinyxmlparser.o: In function `TiXmlDocument::Parse(char const*, TiXmlParsingData*, TiXmlEncoding)':
    tinyxmlparser.cpp:(.text+0x1b31): undefined reference to `TiXmlNode::LinkEndChild(TiXmlNode*)'
    tinyxmlparser.o: In function `TiXmlElement::Parse(char const*, TiXmlParsingData*, TiXmlEncoding)':
    tinyxmlparser.cpp:(.text+0x29be): undefined reference to `TiXmlAttributeSet::Add(TiXmlAttribute*)'
    tinyxmlparser.o: In function `TiXmlBase::IsWhiteSpaceCondensed()':
    tinyxmlparser.cpp:(.text._ZN9TiXmlBase21IsWhiteSpaceCondensedEv[TiXmlBase::IsWhiteSpaceCondensed()]+0x6): undefined reference to `TiXmlBase::condenseWhiteSpace'
    tinyxmlparser.o: In function `TiXmlDocument::~TiXmlDocument()':
    tinyxmlparser.cpp:(.text._ZN13TiXmlDocumentD0Ev[TiXmlDocument::~TiXmlDocument()]+0x25): undefined reference to `TiXmlNode::~TiXmlNode()'
    tinyxmlparser.o: In function `TiXmlDocument::~TiXmlDocument()':
    tinyxmlparser.cpp:(.text._ZN13TiXmlDocumentD1Ev[TiXmlDocument::~TiXmlDocument()]+0x25): undefined reference to `TiXmlNode::~TiXmlNode()'
    tinyxmlparser.o: In function `TiXmlAttribute::Print(_IO_FILE*, int) const':
    tinyxmlparser.cpp:(.text._ZNK14TiXmlAttribute5PrintEP8_IO_FILEi[TiXmlAttribute::Print(_IO_FILE*, int) const]+0x23): undefined reference to `TiXmlAttribute::Print(_IO_FILE*, int, TiXmlString*) const'
    tinyxmlparser.o: In function `TiXmlNode::GetDocument()':
    tinyxmlparser.cpp:(.text._ZN9TiXmlNode11GetDocumentEv[TiXmlNode::GetDocument()]+0xd): undefined reference to `TiXmlNode::GetDocument() const'
    tinyxmlparser.o: In function `TiXmlText::TiXmlText(char const*)':
    tinyxmlparser.cpp:(.text._ZN9TiXmlTextC1EPKc[TiXmlText::TiXmlText(char const*)]+0x16): undefined reference to `TiXmlNode::TiXmlNode(TiXmlNode::NodeType)'
    tinyxmlparser.cpp:(.text._ZN9TiXmlTextC1EPKc[TiXmlText::TiXmlText(char const*)]+0x1b): undefined reference to `vtable for TiXmlText'
    tinyxmlparser.cpp:(.text._ZN9TiXmlTextC1EPKc[TiXmlText::TiXmlText(char const*)]+0x4c): undefined reference to `TiXmlNode::~TiXmlNode()'
    tinyxmlparser.o: In function `TiXmlDeclaration::TiXmlDeclaration()':
    tinyxmlparser.cpp:(.text._ZN16TiXmlDeclarationC1Ev[TiXmlDeclaration::TiXmlDeclaration()]+0x15): undefined reference to `TiXmlNode::TiXmlNode(TiXmlNode::NodeType)'
    tinyxmlparser.cpp:(.text._ZN16TiXmlDeclarationC1Ev[TiXmlDeclaration::TiXmlDeclaration()]+0x1a): undefined reference to `vtable for TiXmlDeclaration'
    tinyxmlparser.o: In function `TiXmlComment::TiXmlComment()':
    tinyxmlparser.cpp:(.text._ZN12TiXmlCommentC1Ev[TiXmlComment::TiXmlComment()]+0x15): undefined reference to `TiXmlNode::TiXmlNode(TiXmlNode::NodeType)'
    tinyxmlparser.cpp:(.text._ZN12TiXmlCommentC1Ev[TiXmlComment::TiXmlComment()]+0x1a): undefined reference to `vtable for TiXmlComment'
    tinyxmlparser.o: In function `TiXmlUnknown::TiXmlUnknown()':
    tinyxmlparser.cpp:(.text._ZN12TiXmlUnknownC1Ev[TiXmlUnknown::TiXmlUnknown()]+0x15): undefined reference to `TiXmlNode::TiXmlNode(TiXmlNode::NodeType)'
    tinyxmlparser.cpp:(.text._ZN12TiXmlUnknownC1Ev[TiXmlUnknown::TiXmlUnknown()]+0x1a): undefined reference to `vtable for TiXmlUnknown'
    tinyxmlparser.o: In function `TiXmlAttributeSet::Find(char const*)':
    tinyxmlparser.cpp:(.text._ZN17TiXmlAttributeSet4FindEPKc[TiXmlAttributeSet::Find(char const*)]+0x14): undefined reference to `TiXmlAttributeSet::Find(char const*) const'
    tinyxmlparser.o:(.rodata._ZTV13TiXmlDocument[vtable for TiXmlDocument]+0x10): undefined reference to `TiXmlDocument::Print(_IO_FILE*, int) const'
    tinyxmlparser.o:(.rodata._ZTV13TiXmlDocument[vtable for TiXmlDocument]+0x48): undefined reference to `TiXmlDocument::Clone() const'
    tinyxmlparser.o:(.rodata._ZTV13TiXmlDocument[vtable for TiXmlDocument]+0x4c): undefined reference to `TiXmlDocument::Accept(TiXmlVisitor*) const'
    tinyxmlparser.o:(.rodata._ZTI13TiXmlDocument[typeinfo for TiXmlDocument]+0x8): undefined reference to `typeinfo for TiXmlNode'
    collect2: ld a retourné 1 code d'état d'exécution
    Voici le fichier main.cpp
    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
     
    #include <iostream>
    #include "boost/date_time/gregorian/gregorian.hpp"
    #include "tinyxml.h"
     
    using namespace std;
    int main(){
            TiXmlDocument doc("birthday.xml");
    	if(!doc.LoadFile()){
       	cerr << "erreur lors du chargement" << endl;
       	cerr << "error #" << doc.ErrorId() << " : " << doc.ErrorDesc() << endl;
        	return 1;
    	}
     
    	return 0;
    }
    Cependant, si je compile simplement comme ceci:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    $ g++ -o main main.cpp -lboost_date_time
    il m'affiche:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
     
    /tmp/ccchtGWH.o: In function `main':
    main.cpp:(.text+0xb3): undefined reference to `TiXmlDocument::TiXmlDocument(char const*)'
    main.cpp:(.text+0xc6): undefined reference to `TiXmlDocument::LoadFile(TiXmlEncoding)'
    /tmp/ccchtGWH.o: In function `TiXmlString::quit()':
    main.cpp:(.text._ZN11TiXmlString4quitEv[TiXmlString::quit()]+0xc): undefined reference to `TiXmlString::nullrep_'
    /tmp/ccchtGWH.o: In function `TiXmlDocument::~TiXmlDocument()':
    main.cpp:(.text._ZN13TiXmlDocumentD1Ev[TiXmlDocument::~TiXmlDocument()]+0x7): undefined reference to `vtable for TiXmlDocument'
    main.cpp:(.text._ZN13TiXmlDocumentD1Ev[TiXmlDocument::~TiXmlDocument()]+0x25): undefined reference to `TiXmlNode::~TiXmlNode()'
    collect2: ld a retourné 1 code d'état d'exécution
    Avez-vous une idée ? Je précise que je voudrais connaître la méthode sous linux.

    Merci d'avance.

  2. #2
    Membre Expert

    Profil pro
    Inscrit en
    Juin 2006
    Messages
    1 294
    Détails du profil
    Informations personnelles :
    Localisation : Royaume-Uni

    Informations forums :
    Inscription : Juin 2006
    Messages : 1 294
    Par défaut
    Salut,

    Je pense que le mieux est de se référer à la documentation de TinyXML, en particulier à la section 'Using and Installing'.

    Par curiosité : comment tu as installé boost pour pouvoir l'utiliser ? Y'a pas moyen de faire pareil avec TinyXML (genre un package) ?

    MAT.

  3. #3
    Membre averti
    Inscrit en
    Mars 2007
    Messages
    25
    Détails du profil
    Informations forums :
    Inscription : Mars 2007
    Messages : 25
    Par défaut
    Citation Envoyé par Mat007
    Salut,

    Je pense que le mieux est de se référer à la documentation de TinyXML, en particulier à la section 'Using and Installing'.

    Par curiosité : comment tu as installé boost pour pouvoir l'utiliser ? Y'a pas moyen de faire pareil avec TinyXML (genre un package) ?

    MAT.
    Je suis ce qu'ils disent sur le site officiel, mais celà ne fonctionne pas

    Pour boost, j'ai installé les packages libboost-dev et libboost-date-time-dev. Il n'y a malheureusement aucun package pour TinyXML.

  4. #4
    Membre éclairé
    Profil pro
    Inscrit en
    Février 2006
    Messages
    396
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Février 2006
    Messages : 396
    Par défaut
    Bonjour,

    Je sais pas si ça va t'aider mais pour utiliser tinyXml, je fait comme ceci :

    1) Dans le dossier de tinyXml j'ai un fichier Makefile, donc un petit make et ça me compile tous les fichiers.
    2) Pour les include, j'inclus ses 2 fichiers : tinystr.h et tinyxml.h
    3) Lors du link, j'utilise ses fichiers : tinystr.o tinyxmlerror.o tinyxml.o tinyxmlparser.o

    Je ne sais pas si c'est la meilleur méthode mais en tout cas ça fonctionne, lol

  5. #5
    Membre averti
    Inscrit en
    Mars 2007
    Messages
    25
    Détails du profil
    Informations forums :
    Inscription : Mars 2007
    Messages : 25
    Par défaut
    Citation Envoyé par zenux
    Bonjour,

    Je sais pas si ça va t'aider mais pour utiliser tinyXml, je fait comme ceci :

    1) Dans le dossier de tinyXml j'ai un fichier Makefile, donc un petit make et ça me compile tous les fichiers.
    2) Pour les include, j'inclus ses 2 fichiers : tinystr.h et tinyxml.h
    3) Lors du link, j'utilise ses fichiers : tinystr.o tinyxmlerror.o tinyxml.o tinyxmlparser.o

    Je ne sais pas si c'est la meilleur méthode mais en tout cas ça fonctionne, lol
    Pourrais-tu me donner la commande que tu utilise pour le link ? Et lorsque tu fais un make dans le dossier tinyxml, tu copie les *.o dans ton dossier de ton programme ?

    C'est ce que j'ai fait, ensuite j'ai tappé ceci:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
    $ g++ -o main.o -c main.cpp
    $ g++ -o main tinystr.o tinyxmlerror.o tinyxml.o tinyxmlparser.o main.o
    et ça m'affiche:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
    main.o: In function `TiXmlString::quit()':
    main.cpp:(.text._ZN11TiXmlString4quitEv[TiXmlString::quit()]+0xc): undefined reference to `TiXmlString::nullrep_'
    collect2: ld a retourné 1 code d'état d'exécution

  6. #6
    Membre éclairé
    Profil pro
    Inscrit en
    Février 2006
    Messages
    396
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Février 2006
    Messages : 396
    Par défaut
    Quand je fait un make dans le dossier de tinyXml, voici ce qu'il fait

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    $ make
    g++ -c -Wall -Wno-format -g -DDEBUG  -DTIXML_USE_STL  tinyxml.cpp -o tinyxml.o
    g++ -c -Wall -Wno-format -g -DDEBUG  -DTIXML_USE_STL  tinyxmlparser.cpp -o tinyxmlparser.o
    g++ -c -Wall -Wno-format -g -DDEBUG  -DTIXML_USE_STL  xmltest.cpp -o xmltest.o
    g++ -c -Wall -Wno-format -g -DDEBUG  -DTIXML_USE_STL  tinyxmlerror.cpp -o tinyxmlerror.o
    g++ -c -Wall -Wno-format -g -DDEBUG  -DTIXML_USE_STL  tinystr.cpp -o tinystr.o
    g++ -o xmltest -g tinyxml.o tinyxmlparser.o xmltest.o tinyxmlerror.o tinystr.o
    Il compile même un programme d'exemple (xmltest) et tu peux voir comment il fait le link. D'ailleur pour mon projet je fait le link de la même manière et je laisse les *.o dans le dossier tinyXml.

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

Discussions similaires

  1. Réponses: 1
    Dernier message: 11/01/2014, 19h57
  2. TinyXML compilation sur windows 7 64 bits
    Par Gloria_Im dans le forum VC++ .NET
    Réponses: 1
    Dernier message: 05/05/2012, 13h33
  3. Réponses: 3
    Dernier message: 02/02/2012, 15h22
  4. [TinyXml] des ennuis de compilation
    Par jalelouss dans le forum Eclipse C & C++
    Réponses: 1
    Dernier message: 13/08/2007, 10h56
  5. [tinyXML] installation / compilation
    Par maminova77 dans le forum C++Builder
    Réponses: 2
    Dernier message: 07/06/2006, 19h04

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