Bonjour,

J'ai un probl�me de r�f�rence sous Eclipse, j'ai le message suivant lorsque que je compile mon projet
undefined reference to `Entreprise::liste_entreprises'
Cette erreur apparait m�me lorsque j'exclus toutes mes autres classes du build.

J'ai donc plus qu'un fichier Entreprise.h et Entreprise.cpp.

Le fichier Entreprise.h contient une map static priv�e :
Code : S�lectionner tout - Visualiser dans une fen�tre � part
1
2
 
static map<string, Entreprise*> liste_entreprises;
Une des m�thodes dans le fichier cpp fait r�f�rence � cet attribut de cette mani�re :
Code : S�lectionner tout - Visualiser dans une fen�tre � part
1
2
3
Entreprise::~Entreprise() {
    Entreprise::liste_entreprises.erase(this->siret); // <-- Erreur : undefined reference to `Entreprise::liste_entreprises'
}
Bien �videmment tous les includes sont OK

Je ne trouve pas de solutions, �tant donn� que lorsque je compile � la main �a fonctionne.
Voici la totalit� du retour console :
make all
Building target: banque
Invoking: GCC C++ Linker
g++ -o"banque" ./Entreprise.o
/usr/lib/gcc/x86_64-redhat-linux/4.5.1/../../../../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
./Entreprise.o: In function `~Entreprise':
/home/Thibaut/workspace/banque/Debug/../Entreprise.cpp:23: undefined reference to `Entreprise::liste_entreprises'
./Entreprise.o: In function `Entreprise::setSiret(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
/home/Thibaut/workspace/banque/Debug/../Entreprise.cpp:49: undefined reference to `Entreprise::liste_entreprises'
/home/Thibaut/workspace/banque/Debug/../Entreprise.cpp:49: undefined reference to `Entreprise::liste_entreprises'
/home/Thibaut/workspace/banque/Debug/../Entreprise.cpp:50: undefined reference to `Entreprise::liste_entreprises'
/home/Thibaut/workspace/banque/Debug/../Entreprise.cpp:52: undefined reference to `Entreprise::addEntreprise(Entreprise*)'
/home/Thibaut/workspace/banque/Debug/../Entreprise.cpp:54: undefined reference to `CompteException::CompteException(int, int)'
/home/Thibaut/workspace/banque/Debug/../Entreprise.cpp:54: undefined reference to `CompteException::~CompteException()'
/home/Thibaut/workspace/banque/Debug/../Entreprise.cpp:54: undefined reference to `typeinfo for CompteException'
/home/Thibaut/workspace/banque/Debug/../Entreprise.cpp:56: undefined reference to `CompteException::~CompteException()'
/home/Thibaut/workspace/banque/Debug/../Entreprise.cpp:56: undefined reference to `typeinfo for CompteException'
./Entreprise.o: In function `Entreprise::setNom(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
/home/Thibaut/workspace/banque/Debug/../Entreprise.cpp:64: undefined reference to `CompteException::CompteException(int, int)'
/home/Thibaut/workspace/banque/Debug/../Entreprise.cpp:64: undefined reference to `CompteException::~CompteException()'
/home/Thibaut/workspace/banque/Debug/../Entreprise.cpp:64: undefined reference to `typeinfo for CompteException'
./Entreprise.o: In function `Entreprise::printIdents()':
/home/Thibaut/workspace/banque/Debug/../Entreprise.cpp:82: undefined reference to `Entreprise::liste_entreprises'
/home/Thibaut/workspace/banque/Debug/../Entreprise.cpp:84: undefined reference to `Entreprise::liste_entreprises'
./Entreprise.o.gcc_except_table+0xbc): undefined reference to `typeinfo for CompteException'
./Entreprise.o.gcc_except_table+0xd4): undefined reference to `typeinfo for CompteException'
./Entreprise.o: In function `CompteException':
/home/Thibaut/workspace/banque/Debug/../CompteException.h:24: undefined reference to `vtable for CompteException'
collect2: ld a retourn� 1 code d'�tat d'ex�cution
make: *** [banque] Erreur 1
Quelqu'un aurait-il une id�e du probl�me ?

Merci d'avance pour votre aide.