1 pièce(s) jointe(s)
Problème undefined reference
Bonjour, deja merci de prendre le temps de m'aider. Donc voici mon probleme j'ai un projet a faire en c++, sauf que tout marché hier soir, je relance ce matin boom ca ne marche plus. Undefined reference quand je compile sur quasiment tous mes fichier. Voici l'exmple d'un fichier
main.cpp
Code:
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
| /*#include "passager.h"
#include "reservation.h"
#include "vol.h"
#include "destination.h"
#include "admin.h"*/
#include "date.h"
#include <iostream>
using namespace std;
int main(void){
//Destination d("Paris", "NewYork");
//Date d1(2020,11,30);
Date test(10,10,10);
//cout<<test.toString()<<endl;
//Vol v(234, 93, d, d1, 5);
//Passager p1("matt", "sochaj", 20, "madame", 69);
//cout << p1.toString() << endl;
//cout << v.toString() << endl;
//p1.reserver(1,1);
//Reservation r(2,2,2);
//p1.setReservation(r);
//p1.confirmerReservation();
//cout<<p1.getReservation().toString()<<endl;
} |
date.h
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| #pragma once
#include <string>
using namespace std;
class Date
{
private:
int annee;
int mois;
int jour;
public:
Date();
Date(int annee, int mois, int jour);
int getAnnee();
void setAnnee(int annee);
int getMois();
void setMois(int mois);
int getJour();
void setJour(int jour);
string toString();
}; |
date.cpp
Code:
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
| #include "date.h"
public:
Date::Date(){
this->annee = 0;
this->mois = 0;
this->jour = 0;
}
Date::Date(int a, int m, int j){
Date::this->annee = a;
Date::this->mois = m;
Date::this->jour = j;
}
int Date::getAnnee(){
return this->annee;
}
void Date::setAnnee(int annee){
this->annee=annee;
}
int Date::getMois(){
return this->mois;
}
void Date::setMois(int mois){
this->mois=mois;
}
int Date::getJour(){
return this->jour;
}
void Date::setJour(int jour){
this->jour=jour;
}
string Date::toString(){
string s;
s= "Annee: " + to_string(this->annee) + " Mois: " + to_string(this->mois) + " Jour: " + to_string(this->jour);
return s;
} |
Pièce jointe 586213
Voila je precise que je suis sur visualStudioCode donc normalement il inclu les .cpp lors de la compilation merci !
Je ne sais pas pourquoi ca s'affiche mal
Voici mes 2 constructeurs dans main.cpp
Code:
1 2 3 4 5 6 7 8 9 10
| Date:: Date(){
this->annee = 0;
this->mois = 0;
this->jour = 0;
}
Date:: Date(int a, int m, int j){
this->annee = a;
this->mois = m;
this->jour = j;
} |