"no matching function for call" alors que je n'utilise pas cette fonction
Bonjour,
Je n'ai pas l'habitude de demander de l'aide en pastant un gros bout de code, mais là, comme je ne sais absoluement pas d'où vient le problème, je me permet de le faire.
Voici mon code, avec l'erreur en commentaire, sur la ligne concernée.
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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
| #include <Python.h>
#include <iostream>
#include <string>
#include <vector>
#include "python.h"
using std::string;
using std::istringstream;
using namespace std;
vector<string> get_binds()
{
vector<string> binds;
binds.clear();
binds.push_back("ACTION");
binds.push_back("CONNECT");
binds.push_back("CTCP");
binds.push_back("JOIN");
binds.push_back("KICK");
binds.push_back("NICK");
binds.push_back("NOTICE");
binds.push_back("PART");
binds.push_back("PING");
binds.push_back("PRIVMSG");
return binds;
}
class PythonLoader {
public:
PythonLoader() { // python.cpp:53: error: no matching function for call to Serveur::Serveur()
Py_Initialize();
signal(SIGINT, SIG_DFL);
PyRun_SimpleString("__import__('sys').path.append('./modules/')");
}
~PythonLoader() {
Py_Finalize();
}
int load_module(const char* name) {
PyObject *pModule;
pModule = PyImport_ImportModule(name);
if (pModule == NULL) {
cout << "Impossible de charger le module Python " << name << endl;
return -1;
}
else {
this->pModules.push_back(pModule);
this->idToName.push_back(name);
return 0;
}
}
int call_function(const char *mod_name, const char *func_name, PyObject *pArgs) {
PyObject* pFunc;
for (unsigned int i=0; i < this->idToName.size(); i++) {
if (this->idToName.at(i) == mod_name) {
pFunc = PyObject_GetAttrString(this->pModules.at(i), func_name);
if (pFunc && PyCallable_Check(pFunc)) {
PyObject_CallObject(pFunc, pArgs);
return 0;
}
else {
return 1;
}
}
}
return -1;
}
int set_current_Serveur(Serveur &serveur) {
this->serveur = serveur;
return 0;
}
Serveur get_current_Serveur() {
return this->serveur;
}
private:
vector<PyObject *> pModules;
vector<string> idToName;
Serveur serveur;
};
PythonLoader pythonLoader; |
J'utilise Linux et le compilateur G++. J'ai un Makefile pour réaliser mon make.
Merci d'avance,
ProgVal
EDIT : Voici ce que me dit make :
Code:
1 2 3 4 5 6 7
| progval@ProgVal-Lucid:~/workspace/Tethys/modules/python$ make
g++ -o python.o -c python.cpp -I . -W -Wall -Wmain -O3 -Wno-deprecated -fPIC -I/usr/include/python2.6 -I/usr/include/python2.6 -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -O0 -g
python.cpp: In constructor PythonLoader::PythonLoader():
python.cpp:53: error: no matching function for call to Serveur::Serveur()
../../src/lib/bot_api.h:136: note: candidates are: Serveur::Serveur(int, std::string, std::string, std::string, std::string, std::string, std::string)
../../src/lib/bot_api.h:134: note: Serveur::Serveur(const Serveur&)
make: *** [python.o] Erreur 1 |