[Résolu]probleme compilation
Voila remi au C++ depuis ce we pour un projet, je rencontre une erreur a la comilation que je ne compren pas :
il s'agit d'une classe gerant un acces à une base de données mysql à l'aide de la librairie mysql++
Voici le retour d'erreur :
Code:
1 2 3 4 5
|
g++ -I/usr/local/include/mysql++ -I/usr/include/mysql -I/usr/local/include/jwsmtp-1.32 -O2 -c controlBDD.cccontrolBDD.cc:29: erreur: nouveaux types ne peuvent être définis dans un type à retourner
controlBDD.cc:29: note: (perhaps a semicolon is missing after the definition of ‘ControlBDD’)
controlBDD.cc:29: erreur: spécification de type retourné pour un constructeur est invalide
make: *** [controlBDD.o] Erreur 1 |
le .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 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
#include <string>
#include <vector>
#include <iostream>
#include <mysql++.h>
using namespace std;
using namespace mysqlpp;
class ControlBDD {
private:
string hostname;
string dbname;
string login;
string pass;
mysqlpp::Connection connexion;
public:
//ControlBDD(void){}
ControlBDD(string hostname,string dbname,string login,string password);
string getHostname(void);
void setHostname(string hostname);
string getDbname(void);
void setDbname(string dbname);
string getLogin(void);
void setLogin(string login);
string getPass(void);
void setPass(string pass);
bool connexionDb(void);
void recupererPrestataire(vector<string> params);
void recupererDestinataire(vector<string> params);
void closeConnexionDb(void);
~ControlBDD(void);
} |
et enfin le .c
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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
#include "controlBDD.h"
ControlBDD::ControlBDD(string hostname, string dbname, string login, string pass):hostname(hostname),dbname(dbname),login(login),pass(pass) {
connexion = Connection(true);
}
string ControlBDD::getHostname(void) {
return hostname;
}
void ControlBDD::setHostname(string hostname) {
this->hostname = hostname;
}
string ControlBDD::getDbname(void) {
return dbname;
}
void ControlBDD::setDbname(string dbname) {
this->dbname = dbname;
}
string ControlBDD::getLogin(void) {
return login;
}
void ControlBDD::setLogin(string login) {
this->login = login;
}
string ControlBDD::getPass(void) {
return pass;
}
void ControlBDD::setPass(string pass) {
this->pass = pass;
}
bool ControlBDD::connexionDb(void) {
bool res;
res = connexion.connect(getHostname().c_str(),getDbname().c_str(),getLogin().c_str(),getPass().c_str());
if (res == true)
{
cout<<"Connexion établie a la base"<<endl;
return true;
}
else
{
cout<<"Connexion a la base echoue"<<endl;
return false;
}
}
void ControlBDD::closeConnexionDb(void) {
connexion.close();
} |
En espérant que vous pourrez m'aider ...[/code]