Reference indéfini vers ..
	
	
		Bonjour ,
 Lorsque je compile , il me reste 2 erreurs que je n'arrive pas a solutionner . 
	Code:
	
| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 
 | #ifndef PERSONNE_HPP_
#define PERSONNE_HPP_
 
#include <string>
 
class Personne
{
  private:
  std::string nom;
  std::string prenom;
  int age;
 
  public:
  Personne();
  void afficher();
  std::string get_nom();
  std::string get_prenom();
  int get_age();
 
  void set_nom(std::string a);
  void set_prenom(std::string b);
  void set_age(int c);
 
};
 
#endif /* PERSONNE_HPP_ */ | 
 
	Code:
	
| 12
 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
 
 | #include "personne.h"
#include <iostream>
#include <string>
 
 
std::string nom,prenom;
int age;
 
Personne::Personne()
{
	nom = "";
	prenom = "";
	age=0;
}
 
void Personne::afficher()
{
	std::cout << "Nom: " << nom << std::endl;
	std::cout << "prenom: " << prenom << std::endl;
	std::cout << "Age: " << age << std::endl;
}
 
std::string get_nom(){return nom;}
std::string get_prenom(){return prenom;}
int get_age(){return age;}
 
void set_nom(std::string a){nom = a;}
void set_prenom(std::string b){prenom = b;}
void set_age(int c){age = c;} | 
 
	Code:
	
| 12
 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
 
 | #include "personne.h"
#include <iostream>
#include <string>
using namespace std;
 
int main()
{
 Personne chris;
 string a,b;
 int c;
 cout << "Entrez nom famille:" << endl;
 cin >> a;
 chris.set_nom(a);
 cin.ignore();
 cout << "Entrez prenom: " << endl;
 cin >>b;
 chris.set_prenom(b);
 cin.ignore();
 cout << "Entrez age: " << endl;
 cin >>c;
 chris.set_age(c);
 cin.ignore();
 
 chris.afficher();
 
 return 0;
} | 
 Et donc j'ai ces 2 erreurs : 
	Code:
	
| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 
 | 18:17:19 **** Incremental Build of configuration Debug for project personne ****
make all 
Building target: personne
Invoking: GCC C++ Linker
g++  -o "personne"  ./main.o ./personne.o   
./main.o*: Dans la fonction «*main*»*:
/home/chris/Projets_C++/personne/Debug/../main.cpp:13*: référence indéfinie vers «*Personne::set_nom(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)*»
/home/chris/Projets_C++/personne/Debug/../main.cpp:17*: référence indéfinie vers «*Personne::set_prenom(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)*»
/home/chris/Projets_C++/personne/Debug/../main.cpp:21*: référence indéfinie vers «*Personne::set_age(int)*»
makefile:44: recipe for target 'personne' failed
collect2: error: ld returned 1 exit status
make: *** [personne] Error 1
"make all" terminated with exit code 2. Build might be incomplete.
 
18:17:20 Build Failed. 2 errors, 0 warnings. (took 745ms) | 
 Merci de votre aide .