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

C++ Discussion :

Undefined reference to nbJob


Sujet :

C++

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre éclairé
    Avatar de Le Barde
    Homme Profil pro
    Chanteur
    Inscrit en
    Juillet 2007
    Messages
    343
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France, Loiret (Centre)

    Informations professionnelles :
    Activité : Chanteur

    Informations forums :
    Inscription : Juillet 2007
    Messages : 343
    Par défaut Undefined reference to nbJob
    Bonjour à tous,

    Petit problème à la compilation de mon projet. Voici sans plus attendre la sortie du 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
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    adrien@adrien-portable:~/Documents/Travail/recherche/StageFlowShop/C++$ make
    test -d Executable/ || mkdir -p Executable/
    g++  -o Executable/Projet Application.o Atelier.o BandB.o ListeNoeuds.o Noeud.o Distrib.o Ordo.o Console.o Array.o    -L/usr/share/qt3/lib -L/usr/X11R6/lib -lqt-mt -lXext -lX11 -lm -lpthread
    BandB.o: In function `BandB::Developpe()':
    BandB.cpp:(.text+0x81): undefined reference to `BandB::nbJob'
    BandB.cpp:(.text+0xa9): undefined reference to `BandB::nbJob'
    BandB.cpp:(.text+0xf7): undefined reference to `BandB::nbJob'
    BandB.cpp:(.text+0x12b): undefined reference to `Console<char*>::Afficher(char*)'
    BandB.cpp:(.text+0x136): undefined reference to `Console<int>::Afficher(int)'
    BandB.cpp:(.text+0x142): undefined reference to `Console<char*>::Afficher(char*)'
    BandB.o: In function `BandB::BandB(Ordo*)':
    BandB.cpp:(.text+0x180): undefined reference to `BandB::probleme'
    BandB.cpp:(.text+0x19e): undefined reference to `BandB::nbJob'
    BandB.cpp:(.text+0x1a3): undefined reference to `BandB::probleme'
    BandB.cpp:(.text+0x1b6): undefined reference to `BandB::nbMach'
    BandB.cpp:(.text+0x1bb): undefined reference to `BandB::probleme'
    BandB.cpp:(.text+0x211): undefined reference to `BandB::nbJob'
    BandB.cpp:(.text+0x225): undefined reference to `BandB::nbMach'
    BandB.cpp:(.text+0x256): undefined reference to `BandB::nbMach'
    BandB.cpp:(.text+0x265): undefined reference to `BandB::nbJob'
    BandB.cpp:(.text+0x2c4): undefined reference to `BandB::nbMach'
    BandB.cpp:(.text+0x2f3): undefined reference to `BandB::probleme'
    BandB.cpp:(.text+0x304): undefined reference to `BandB::nbMach'
    BandB.cpp:(.text+0x311): undefined reference to `BandB::nbMach'
    BandB.cpp:(.text+0x326): undefined reference to `BandB::nbJob'
    BandB.o: In function `BandB::BandB(Ordo*)':
    BandB.cpp:(.text+0x360): undefined reference to `BandB::probleme'
    BandB.cpp:(.text+0x37e): undefined reference to `BandB::nbJob'
    BandB.cpp:(.text+0x383): undefined reference to `BandB::probleme'
    BandB.cpp:(.text+0x396): undefined reference to `BandB::nbMach'
    BandB.cpp:(.text+0x39b): undefined reference to `BandB::probleme'
    BandB.cpp:(.text+0x3ee): undefined reference to `BandB::nbJob'
    BandB.cpp:(.text+0x405): undefined reference to `BandB::nbMach'
    BandB.cpp:(.text+0x436): undefined reference to `BandB::nbMach'
    BandB.cpp:(.text+0x445): undefined reference to `BandB::nbJob'
    BandB.cpp:(.text+0x45a): undefined reference to `BandB::nbMach'
    BandB.cpp:(.text+0x49b): undefined reference to `BandB::nbMach'
    BandB.cpp:(.text+0x4ca): undefined reference to `BandB::probleme'
    BandB.cpp:(.text+0x4e5): undefined reference to `BandB::nbMach'
    BandB.cpp:(.text+0x4f2): undefined reference to `BandB::nbMach'
    BandB.cpp:(.text+0x505): undefined reference to `BandB::nbJob'
    BandB.cpp:(.text+0x51c): undefined reference to `BandB::nbMach'
    BandB.o: In function `BandB::Developpe()':
    BandB.cpp:(.text+0x154): undefined reference to `Console<int>::Afficher(int)'
    Noeud.o: In function `Noeud::Evaluer()':
    Noeud.cpp:(.text+0x4a): undefined reference to `BandB::probleme'
    Noeud.cpp:(.text+0x81): undefined reference to `BandB::probleme'
    Noeud.cpp:(.text+0xda): undefined reference to `BandB::probleme'
    Noeud.cpp:(.text+0x11d): undefined reference to `BandB::probleme'
    Noeud.o: In function `Noeud::Noeud(Noeud*, int)':
    Noeud.cpp:(.text+0x1c0): undefined reference to `BandB::probleme'
    Noeud.o:Noeud.cpp:(.text+0x1e3): more undefined references to `BandB::probleme' follow
    Ordo.o: In function `Ordo::NEH()':
    Ordo.cpp:(.text+0xd3d): undefined reference to `Array<double>::Sort(double*, int*)'
    Ordo.cpp:(.text+0xd48): undefined reference to `Array<double>::Reverse(int*)'
    Ordo.o: In function `Ordo::NEHameliore()':
    Ordo.cpp:(.text+0xf52): undefined reference to `Array<double>::Sort(double*, int*)'
    Ordo.cpp:(.text+0xf5d): undefined reference to `Array<double>::Reverse(int*)'
    Ordo.o: In function `Ordo::Flowshop()':
    Ordo.cpp:(.text+0x1084): undefined reference to `Console<double>::EnString(double)'
    Ordo.cpp:(.text+0x10cd): undefined reference to `Console<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >::Afficher(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
    Ordo.cpp:(.text+0x112c): undefined reference to `Console<double>::EnString(double)'
    Ordo.cpp:(.text+0x1198): undefined reference to `Console<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >::Afficher(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
    collect2: ld a retourné 1 code d'état d'exécution
    make: *** [Executable/Projet] Erreur 1
    adrien@adrien-portable:~/Documents/Travail/recherche/StageFlowShop/C++$ 
    adrien@adrien-portable:~/Documents/Travail/recherche/StageFlowShop/C++$
    BandB.o: In function `BandB::Developpe()':
    BandB.cpp:(.text+0x81): undefined reference to `BandB::nbJob'
    Le compilateur ne reconnaît visiblement pas nbJob (entre autres), qui est défini dans BandB.h :
    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
    #ifndef BandB_H
    #define BandB_H
     
    #include "Noeud.hpp"
    #include "ListeNoeuds.hpp"
    #include "../Ordo.hpp"
     
     
    class BandB
     
    {
     
        private:
        static int nbJob;
     
        static int nbMach;
     
        Noeud* racine;
        Noeud* noeudFils;
     
     
        public:
        static Ordo* probleme;
        ListeNoeuds* listeNoeuds;
     
        Noeud* noeudOpt;
     
        int nbDev, nbNoeud;
     
        double zopt;
        double** spij;
     
     
     
        public:
     
        BandB(Ordo* ordo);
     
     
        void Developpe();
        Noeud* NouveauNoeudCourant();
     
    };
     
     
    #endif
    Et voici le BandB.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
    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
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    #include "BandB.h"
    #include <cstdlib>
    #include "../../Entrees-Sorties/Console.h"
    #include "../Ordo.h"
     
     
     
    BandB::BandB(Ordo* ordo)
     
            {
     
                // Initialisation de la recherche
     
                nbDev = 0; nbNoeud = 0;
                probleme = ordo;
     
                nbJob = probleme->reference->GetNbJob();
     
                nbMach = probleme->reference->GetNbMach();
     
                zopt = probleme->Resultat;
     
                racine = new Noeud(listeNoeuds);
     
                noeudOpt = racine;
     
                listeNoeuds = new ListeNoeuds(this);
     
     
                spij = new double*[nbJob]; // Initialisation du tableau à 2 dimensions spij.
                for (int a=0; a< nbMach+1 ; a++)
                {
                    spij[a] = new double[nbMach];
                }
     
     
                // Calculs preliminaires pour l'evaluatioin des bornes
     
                for (int i=0; i<nbJob; i++)
     
                    for (int j=0; j<nbMach; j++)
     
                    {
                        int jj;
     
                        spij[i][j]=0;
     
                        if (j<nbMach-1)
     
                            for (jj=j+1; jj<nbMach; jj++)
     
                                spij[i][j] += probleme->reference->Pij(i,jj);
     
                    }
     
     
     
            }
     
     
    void BandB::Developpe()
     
            {
     
                Noeud* noeudCourant = racine;
     
     
     
                while (noeudCourant)
     
                {
                    int i;
     
                    // Developpement du noeud courant
     
                    nbDev++;
     
                    for (i=0; i<nbJob - noeudCourant->niveau; i++)
     
                    {
     
                        noeudFils = new Noeud(noeudCourant, i);
     
                        nbNoeud++;
     
                        noeudFils->Evaluer();
     
                        if (noeudFils->borneInf < zopt)
     
                        {
     
                            if (noeudFils->niveau<nbJob)
     
                                listeNoeuds->PlacerEnTete(noeudFils);
     
                            else
     
                            {
     
                                noeudOpt = noeudFils;
     
                                zopt = noeudOpt->borneInf;
     
                            }
     
                        }
     
                    }
     
     
     
                    // Nouveau noeud à developper
     
                    noeudCourant = NouveauNoeudCourant();
     
     
     
                }
     
                Console<char*>::Afficher("Nb noeuds apparus: ");
     
                Console<int>::Afficher(nbNoeud);
     
                Console<char*>::Afficher("\nNb noeuds developpes:");
     
                Console<int>::Afficher(nbDev);
     
            }
     
     
     
    Noeud* BandB::NouveauNoeudCourant()
     
            {
     
                Noeud* noeudCourant;
     
                if (listeNoeuds->Length!=0)
     
                {
     
                    // Extrait le premier element de la liste, à condition qu'il soit interessant
     
                    noeudCourant = listeNoeuds->Premier();
     
                    while ((noeudCourant)&&(noeudCourant->borneInf>zopt))
     
                        noeudCourant = listeNoeuds->Premier();
     
                }
     
                else noeudCourant = NULL;
     
                return(noeudCourant);
     
            }
    Si vous aviez des idées par rapport à ce message d'erreur...?

  2. #2
    r0d
    r0d est déconnecté
    Membre expérimenté

    Homme Profil pro
    Développeur informatique
    Inscrit en
    Août 2004
    Messages
    4 290
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Ain (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Août 2004
    Messages : 4 290
    Billets dans le blog
    2
    Par défaut
    Bonjour, il faut initialiser les variables statiques.
    Voir la faq

  3. #3
    Membre éclairé Avatar de befalimpertinent
    Profil pro
    Inscrit en
    Avril 2007
    Messages
    561
    Détails du profil
    Informations personnelles :
    Âge : 41
    Localisation : France, Gironde (Aquitaine)

    Informations forums :
    Inscription : Avril 2007
    Messages : 561
    Par défaut
    Salut.
    Une idée...
    Déjà je ne vois pas où est initialisée ta variable static. Procède de la façon suivante initialiser un static
    Et éventuellement tout ce qui suit sur
    Pourquoi les classes avec des membres statiques me donnent-elles des erreurs lors de l'édition des liens ?

  4. #4
    Membre éclairé
    Avatar de Le Barde
    Homme Profil pro
    Chanteur
    Inscrit en
    Juillet 2007
    Messages
    343
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France, Loiret (Centre)

    Informations professionnelles :
    Activité : Chanteur

    Informations forums :
    Inscription : Juillet 2007
    Messages : 343
    Par défaut
    Merci !

    Je ne connaissais pas cette histoire, maintenant j'ai bien initialisé les variables globales.

    EDIT :

    Le make me revoie maintenant :

    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
    adrien@adrien-portable:~/Documents/Travail/recherche/StageFlowShop/C++$ make
    g++ -c -pipe -Wall -W -O2 -D_REENTRANT  -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -DQT_SHARED -DQT_TABLET_SUPPORT -I/usr/share/qt3/mkspecs/default -I. -I/usr/include/qt3 -o BandB.o Flowshop/BandB/BandB.cpp
    test -d Executable/ || mkdir -p Executable/
    g++  -o Executable/Projet Application.o Atelier.o BandB.o ListeNoeuds.o Noeud.o Distrib.o Ordo.o Console.o Array.o    -L/usr/share/qt3/lib -L/usr/X11R6/lib -lqt-mt -lXext -lX11 -lm -lpthread
    BandB.o: In function `BandB::Developpe()':
    BandB.cpp:(.text+0x130): undefined reference to `Console<char*>::Afficher(char*)'
    BandB.cpp:(.text+0x13b): undefined reference to `Console<int>::Afficher(int)'
    BandB.cpp:(.text+0x147): undefined reference to `Console<char*>::Afficher(char*)'
    BandB.cpp:(.text+0x159): undefined reference to `Console<int>::Afficher(int)'
    Noeud.o: In function `Noeud::Evaluer()':
    Noeud.cpp:(.text+0x4a): undefined reference to `BandB::probleme'
    Noeud.cpp:(.text+0x81): undefined reference to `BandB::probleme'
    Noeud.cpp:(.text+0xda): undefined reference to `BandB::probleme'
    Noeud.cpp:(.text+0x11d): undefined reference to `BandB::probleme'
    Noeud.o: In function `Noeud::Noeud(Noeud*, int)':
    Noeud.cpp:(.text+0x1c0): undefined reference to `BandB::probleme'
    Noeud.o:Noeud.cpp:(.text+0x1e3): more undefined references to `BandB::probleme' follow
    Ordo.o: In function `Ordo::NEH()':
    Ordo.cpp:(.text+0xd3d): undefined reference to `Array<double>::Sort(double*, int*)'
    Ordo.cpp:(.text+0xd48): undefined reference to `Array<double>::Reverse(int*)'
    Ordo.o: In function `Ordo::NEHameliore()':
    Ordo.cpp:(.text+0xf52): undefined reference to `Array<double>::Sort(double*, int*)'
    Ordo.cpp:(.text+0xf5d): undefined reference to `Array<double>::Reverse(int*)'
    Ordo.o: In function `Ordo::Flowshop()':
    Ordo.cpp:(.text+0x1084): undefined reference to `Console<double>::EnString(double)'
    Ordo.cpp:(.text+0x10cd): undefined reference to `Console<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >::Afficher(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
    Ordo.cpp:(.text+0x112c): undefined reference to `Console<double>::EnString(double)'
    Ordo.cpp:(.text+0x1198): undefined reference to `Console<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >::Afficher(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
    collect2: ld a retourné 1 code d'état d'exécution
    make: *** [Executable/Projet] Erreur 1
    adrien@adrien-portable:~/Documents/Travail/recherche/StageFlowShop/C++$
    Il faut initialiser aussi les méthodes ? ... comment fait-on ?

  5. #5
    r0d
    r0d est déconnecté
    Membre expérimenté

    Homme Profil pro
    Développeur informatique
    Inscrit en
    Août 2004
    Messages
    4 290
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Ain (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Août 2004
    Messages : 4 290
    Billets dans le blog
    2
    Par défaut
    Non, il ne faut pas initialiser les fonctions statiques. Tu dois avoir un problème au niveau des inclusions.

    En revanche, tu as encore au moins une variable statique non initialisée: BandB::probleme

  6. #6
    Membre éclairé
    Avatar de Le Barde
    Homme Profil pro
    Chanteur
    Inscrit en
    Juillet 2007
    Messages
    343
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France, Loiret (Centre)

    Informations professionnelles :
    Activité : Chanteur

    Informations forums :
    Inscription : Juillet 2007
    Messages : 343
    Par défaut
    Oui oui, j'avais juste initialisé les deux nbJob et nbMach, je n'avais pas touché encore à probleme

    Je vais regarder les inclusions...

  7. #7
    Membre éclairé
    Avatar de Le Barde
    Homme Profil pro
    Chanteur
    Inscrit en
    Juillet 2007
    Messages
    343
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France, Loiret (Centre)

    Informations professionnelles :
    Activité : Chanteur

    Informations forums :
    Inscription : Juillet 2007
    Messages : 343
    Par défaut
    Alors là, je sèche ; voici ce que me dit g++, qui n'a que peu changé depuis tout à l'heure :
    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
    adrien@adrien-portable:~/Documents/Travail/recherche/StageFlowShop/C++$ make
    g++ -c -pipe -Wall -W -O2 -D_REENTRANT  -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -DQT_SHARED -DQT_TABLET_SUPPORT -I/usr/share/qt3/mkspecs/default -I. -I/usr/include/qt3 -o Noeud.o Flowshop/BandB/Noeud.cpp
    test -d Executable/ || mkdir -p Executable/
    g++  -o Executable/Projet Application.o Atelier.o BandB.o ListeNoeuds.o Noeud.o Distrib.o Ordo.o Console.o Array.o    -L/usr/share/qt3/lib -L/usr/X11R6/lib -lqt-mt -lXext -lX11 -lm -lpthread
    BandB.o: In function `BandB::Developpe()':
    BandB.cpp:(.text+0x130): undefined reference to `Console<char*>::Afficher(char*)'
    BandB.cpp:(.text+0x13b): undefined reference to `Console<int>::Afficher(int)'
    BandB.cpp:(.text+0x147): undefined reference to `Console<char*>::Afficher(char*)'
    BandB.cpp:(.text+0x159): undefined reference to `Console<int>::Afficher(int)'
    Ordo.o: In function `Ordo::NEH()':
    Ordo.cpp:(.text+0xd3d): undefined reference to `Array<double>::Sort(double*, int*)'
    Ordo.cpp:(.text+0xd48): undefined reference to `Array<double>::Reverse(int*)'
    Ordo.o: In function `Ordo::NEHameliore()':
    Ordo.cpp:(.text+0xf52): undefined reference to `Array<double>::Sort(double*, int*)'
    Ordo.cpp:(.text+0xf5d): undefined reference to `Array<double>::Reverse(int*)'
    Ordo.o: In function `Ordo::Flowshop()':
    Ordo.cpp:(.text+0x1084): undefined reference to `Console<double>::EnString(double)'
    Ordo.cpp:(.text+0x10cd): undefined reference to `Console<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >::Afficher(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
    Ordo.cpp:(.text+0x112c): undefined reference to `Console<double>::EnString(double)'
    Ordo.cpp:(.text+0x1198): undefined reference to `Console<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >::Afficher(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
    collect2: ld a retourné 1 code d'état d'exécution
    make: *** [Executable/Projet] Erreur 1
    adrien@adrien-portable:~/Documents/Travail/recherche/StageFlowShop/C++$
    Et le BandB.cpp (qui n'a que peu changé lui aussi) :
    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
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    #include "BandB.h"
    #include <cstdlib>
     
    #include "../../Entrees-Sorties/Console.h"
    #include "../Ordo.h"
     
     
    BandB::BandB(Ordo* ordo)
     
    		{
     
    			// Initialisation de la recherche
     
    			nbDev = 0; nbNoeud = 0;
    			probleme = ordo;
     
    			nbJob = probleme->reference->GetNbJob();
     
    			nbMach = probleme->reference->GetNbMach();
     
    			zopt = probleme->Resultat;
     
    			racine = new Noeud(listeNoeuds);
     
    			noeudOpt = racine;
     
    			listeNoeuds = new ListeNoeuds(this);
     
     
    			spij = new double*[nbJob]; // Initialisation du tableau à 2 dimensions spij.
    			for (int a=0; a< nbMach+1 ; a++)
    			{
    				spij[a] = new double[nbMach];
    			}
     
     
    			// Calculs preliminaires pour l'evaluatioin des bornes
     
    			for (int i=0; i<nbJob; i++)
     
    				for (int j=0; j<nbMach; j++)
     
    				{
    					int jj;
     
    					spij[i][j]=0;
     
    					if (j<nbMach-1)
     
    						for (jj=j+1; jj<nbMach; jj++)
     
    							spij[i][j] += probleme->reference->Pij(i,jj);
     
    				}
     
     
     
    		}
     
     
    void BandB::Developpe()
     
    		{
     
    			Noeud* noeudCourant = racine;
     
     
     
    			while (noeudCourant)
     
    			{
    				int i;
     
    				// Developpement du noeud courant
     
    				nbDev++;
     
    				for (i=0; i<nbJob - noeudCourant->niveau; i++)
     
    				{
     
    					noeudFils = new Noeud(noeudCourant, i);
     
    					nbNoeud++;
     
    					noeudFils->Evaluer();
     
    					if (noeudFils->borneInf < zopt)
     
    					{
     
    						if (noeudFils->niveau<nbJob)
     
    							listeNoeuds->PlacerEnTete(noeudFils);
     
    						else
     
    						{
     
    							noeudOpt = noeudFils;
     
    							zopt = noeudOpt->borneInf;
     
    						}
     
    					}
     
    				}
     
     
     
    				// Nouveau noeud à developper
     
    				noeudCourant = NouveauNoeudCourant();
     
     
     
    			}
    			Consolechar::Afficher("Nb noeuds apparus: "); 
    			Console<int>::Afficher(nbNoeud);
     
    			Console<char*>::Afficher("\nNb noeuds developpes:");
     
    			Console<int>::Afficher(nbDev);
     
    		}
     
     
     
    Noeud* BandB::NouveauNoeudCourant()
     
    		{
     
    			Noeud* noeudCourant;
     
    			if (listeNoeuds->Length!=0)
     
    			{
     
    				// Extrait le premier element de la liste, à condition qu'il soit interessant
     
    				noeudCourant = listeNoeuds->Premier();
     
    				while ((noeudCourant)&&(noeudCourant->borneInf>zopt))
     
    					noeudCourant = listeNoeuds->Premier();
     
    			}
     
    			else noeudCourant = NULL;
     
    			return(noeudCourant);
     
    		}
    Le fichier Console.h est bien inclus au début du fichier, je vois aussi que Console.cpp est bien compilé (présence de Console.o)... Je ne vois pas ce qiu manque.

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

Discussions similaires

  1. winsock.h : undefined reference...
    Par abraxas dans le forum Dev-C++
    Réponses: 14
    Dernier message: 06/08/2012, 13h42
  2. Undefined reference compilation réseau
    Par Ren97 dans le forum Dev-C++
    Réponses: 11
    Dernier message: 08/03/2005, 09h46
  3. Compilation de xmms : undefined reference to...
    Par Michaël dans le forum Applications et environnements graphiques
    Réponses: 4
    Dernier message: 04/02/2005, 19h05
  4. undefined reference to `xmlParseFile'
    Par Clemaster dans le forum Autres éditeurs
    Réponses: 2
    Dernier message: 25/06/2004, 20h38
  5. g++ : undefined reference to ...
    Par le_barbu dans le forum Autres éditeurs
    Réponses: 16
    Dernier message: 14/05/2004, 07h23

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