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

Linux Discussion :

Linux - Probleme library perso


Sujet :

Linux

  1. #1
    Membre régulier Avatar de lXT95l
    Profil pro
    Inscrit en
    Novembre 2006
    Messages
    106
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2006
    Messages : 106
    Points : 116
    Points
    116
    Par défaut Linux - Probleme library perso
    Salut a tous,
    j'essais de faire ma propre bibliotheque !
    J'ai donc compiler tout met fichier en .o, je les aient assembler en une bibliotheque, créer le header, j'ai tout bien placer aux bons endroits ! Tout marche et a la compile sa fait comem si il y avait rien ds la bibliotheque !

    Script de création de la lib :
    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
     
    #!/bin/sh
    echo "Compilation ..."
    g++ -c *.cpp
    echo "Création de la bibliotheque ..."
    rm ../Release/libXT3D.a
    ar r ../Release/libXT3D.a *.o
    chmod 777 ../Release/libXT3D.a
    echo "Generation de l'index ..."
    ranlib ../Release/libXT3D.a
    echo "Création du header..."
    cp XT3D.h ../Release -rf
    echo "Nettoyage ..."
    rm *.o
    echo "Terminer !"


    Script d'installation :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
     
    #!/bin/sh
    echo Installation lib XT3D...
    cp ./Release/libXT3D.a /usr/lib
    cp ./Release/XT3D.h /usr/include/XT3D/
    echo Terminer
    Compilation du projet test :
    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
     
    [XT95@localhost test]$ g++ -I include -L/usr/lib -lSDL -lpthread -lSDL_image -lSDL_ttf -lGL -lGLU -lGLEW -lXT3D -o main main.o
    main.o: In function `__static_initialization_and_destruction_0(int, int)':
    main.cpp:(.text+0x2b): undefined reference to `CCameraRPG::CCameraRPG()'
    main.cpp:(.text+0x53): undefined reference to `CMap::CMap()'
    main.cpp:(.text+0x7b): undefined reference to `CSky::CSky()'
    main.cpp:(.text+0xa3): undefined reference to `CWater::CWater()'
    main.cpp:(.text+0xcb): undefined reference to `CTexte::CTexte()'
    main.cpp:(.text+0xf3): undefined reference to `CTexte::CTexte()'
    main.cpp:(.text+0x11b): undefined reference to `CTexte::CTexte()'
    main.o: In function `__tcf_6':
    main.cpp:(.text+0x164): undefined reference to `CTexte::~CTexte()'
    main.o: In function `__tcf_5':
    main.cpp:(.text+0x178): undefined reference to `CTexte::~CTexte()'
    main.o: In function `__tcf_4':
    main.cpp:(.text+0x18c): undefined reference to `CTexte::~CTexte()'
    main.o: In function `__tcf_3':
    main.cpp:(.text+0x1a0): undefined reference to `CWater::~CWater()'
    main.o: In function `__tcf_2':
    main.cpp:(.text+0x1b4): undefined reference to `CSky::~CSky()'
    main.o: In function `__tcf_1':
    main.cpp:(.text+0x1c8): undefined reference to `CMap::~CMap()'
    main.o: In function `Draw()':
    main.cpp:(.text+0x25e): undefined reference to `CMap::TerrainGetHPoint(int, int)'
    main.cpp:(.text+0x284): undefined reference to `CCameraRPG::Look(int)'
    main.cpp:(.text+0x2df): undefined reference to `CSky::SetPosition(int, int, int)'
    main.cpp:(.text+0x2eb): undefined reference to `CSky::Look()'
    main.cpp:(.text+0x2f7): undefined reference to `CMap::Look()'
    main.o: In function `main':
    main.cpp:(.text+0x4f0): undefined reference to `CSky::SetSize(int)'
    main.cpp:(.text+0x504): undefined reference to `CSky::SetBack(char*)'
    main.cpp:(.text+0x518): undefined reference to `CSky::SetFront(char*)'
    main.cpp:(.text+0x52c): undefined reference to `CSky::SetBottom(char*)'
    main.cpp:(.text+0x540): undefined reference to `CSky::SetTop(char*)'
    main.cpp:(.text+0x554): undefined reference to `CSky::SetLeft(char*)'
    main.cpp:(.text+0x568): undefined reference to `CSky::SetRight(char*)'
    main.cpp:(.text+0x574): undefined reference to `CMap::Init()'
    main.cpp:(.text+0x59a): undefined reference to `CMap::Load(char*, bool, bool)'
    main.cpp:(.text+0x5ae): undefined reference to `CCameraRPG::LoadMan(char*)'
    main.cpp:(.text+0x5c2): undefined reference to `CCameraRPG::SetTextureMan(char*)'
    main.cpp:(.text+0x5e5): undefined reference to `CTexte::SetPolice(char*, int)'
    main.cpp:(.text+0x601): undefined reference to `CTexte::SetPosition(int, int)'
    main.cpp:(.text+0x625): undefined reference to `CTexte::SetColor(int, int, int)'
    main.cpp:(.text+0x641): undefined reference to `CTexte::SetPolice(char*, int)'
    main.cpp:(.text+0x65d): undefined reference to `CTexte::SetPosition(int, int)'
    main.cpp:(.text+0x681): undefined reference to `CTexte::SetColor(int, int, int)'
    main.cpp:(.text+0x695): undefined reference to `CTexte::SetTexte(char*)'
    main.cpp:(.text+0x770): undefined reference to `CCameraRPG::GetEvent(SDL_Event*)'
    main.cpp:(.text+0x7d0): undefined reference to `CTexte::SetTexte(char*)'
    main.o: In function `CCameraRPG::~CCameraRPG()':
    main.cpp:(.gnu.linkonce.t._ZN10CCameraRPGD1Ev+0x11): undefined reference to `CObjMd2::~CObjMd2()'
    collect2: ld a retourné 1 code d'état d'exécution


    Que je link la lib ou non il n'y a pas de différence :/ !
    (vague impression que c'est juste les class qui plante...)
    Quelqu'un peut m'aider ? !
    Merci d'avance !

  2. #2
    Membre régulier
    Profil pro
    Inscrit en
    Mai 2002
    Messages
    162
    Détails du profil
    Informations personnelles :
    Âge : 42
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations forums :
    Inscription : Mai 2002
    Messages : 162
    Points : 88
    Points
    88
    Par défaut
    Citation Envoyé par lXT95l
    g++ -I include -L/usr/lib -lSDL ...
    il y a un espace en trop entre le -I et le include, ça devrait être collé : -Iinclude

    De plus, si une lib A (ou un fichier .o) utilise une lib B, A doit être indiqué avant B : g++ -lA -lB

    dans ton cas, il faudrait déjà mettre les -l àprès le -o main main.o

  3. #3
    Membre régulier Avatar de lXT95l
    Profil pro
    Inscrit en
    Novembre 2006
    Messages
    106
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2006
    Messages : 106
    Points : 116
    Points
    116
    Par défaut
    le -I include c'est un "i" !
    Sinon tu a raison, j'ai mis le main.o devant les libs et sa compile merci beaucoup !!

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

Discussions similaires

  1. [Lazarus] Linux : problème avec le deboggueur
    Par Pigoulou dans le forum Lazarus
    Réponses: 1
    Dernier message: 22/12/2005, 15h35
  2. [Linux]probleme au lancement d'eclipse
    Par CodeurNé dans le forum Eclipse Java
    Réponses: 2
    Dernier message: 31/10/2005, 09h49
  3. [linux] Probleme avec la libpcap
    Par uriel0105 dans le forum C
    Réponses: 2
    Dernier message: 12/10/2005, 22h59
  4. [Linux]probleme au lancement d'eclipse sur mandrake 10
    Par Dnx dans le forum Eclipse Java
    Réponses: 2
    Dernier message: 21/09/2004, 19h34
  5. [Linux] Probleme de fermeture de Sockets
    Par diefo dans le forum Réseau
    Réponses: 6
    Dernier message: 30/12/2003, 13h10

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