Bonjour,
J'ai ce message d'erreur que je n'arrive pas a comprendre . Ca doit pas etre grand chose comme d'habitude , mais je vois pas .
Merci de votre aide .
J'ai ce message d'erreur que je n'arrive pas a comprendre . Ca doit pas etre grand chose comme d'habitude , mais je vois pas .
Merci de votre aide .
#ifndef FONCTAB_HPP_
#define FONCTAB_HPP_
#include <iostream>
#include <vector>
class Joueur
{
public:
Joueur();
~Joueur();
void saisie(std::vector<std::string>&tab,size_t taille);
void affiche(std::vector<std::string>&tab,size_t taille);
};
#endif /* FONCTAB_HPP_ */
#include "foncTab.hpp"
using namespace std;
void Joueur::saisie(vector<string> &tab,size_t taille)
{
while(tab.size() < taille)
tab.clear();
for(size_t i(0);i<tab.size();++i){
cout << "Entrez nom du joueur" << i <<":" << endl;
cin >> tab[i];
}
}
void Joueur::affiche(vector<string> &tab,size_t taille)
{
for(size_t i(0);i< tab.size();++i){
cout << "Le joueur" << i << "est" << tab[i]<< endl;
}
}
#include "foncTab.hpp"
#include <iostream>
#include <vector>
using namespace std;
int main()
{
Joueur equipe1,equipe2;
char a;
cout << "Voulez vous faire une partie ?" << endl;
cout << "Tapez o (oui) ou n (non)"<< endl;
cin >> a;
if(a == 'o')
{
size_t nb(0);
cout << "Quel est le nombre de personne dans votre equipe ?" << endl;
cin >> nb;
vector<string>tab;
equipe1.saisie(tab,nb);
cout << "Votre equipe est constitué de :" << nb << "personnes" << endl;
cout << "Voici le nom des joueurs :" << endl;
equipe1.affiche(tab,nb);
}
else
cout << "Aurevoir,a bientot" << endl;
return 0;
}
20:48:48 **** Incremental Build of configuration Debug for project foncTab ****
make all
Building file: ../foncTab.cpp
Invoking: GCC C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"foncTab.d" -MT"foncTab.o" -o "foncTab.o" "../foncTab.cpp"
Finished building: ../foncTab.cpp
Building target: foncTab
Invoking: GCC C++ Linker
g++ -o "foncTab" ./foncTab.o ./main.o
./main.o : Dans la fonction « main » :
/home/chris/eclipse-workspace/foncTab/Debug/../main.cpp:8 : référence indéfinie vers « Joueur::Joueur() »
/home/chris/eclipse-workspace/foncTab/Debug/../main.cpp:8 : référence indéfinie vers « Joueur::Joueur() »
/home/chris/eclipse-workspace/foncTab/Debug/../main.cpp:8 : référence indéfinie vers « Joueur::~Joueur() »
/home/chris/eclipse-workspace/foncTab/Debug/../main.cpp:8 : référence indéfinie vers « Joueur::~Joueur() »
/home/chris/eclipse-workspace/foncTab/Debug/../main.cpp:8 : référence indéfinie vers « Joueur::~Joueur() »
/home/chris/eclipse-workspace/foncTab/Debug/../main.cpp:8 : référence indéfinie vers « Joueur::~Joueur() »
collect2: error: ld returned 1 exit status
makefile:44: recipe for target 'foncTab' failed
make: *** [foncTab] Error 1
"make all" terminated with exit code 2. Build might be incomplete.
20:48:50 Build Failed. 2 errors, 0 warnings. (took 1s.289ms)