Probléme de compilation pour un héritage
Salut à tous! Donc voila j'ai ce probléme incompréhensible pour moi, je n'arrive pas à compiler un bout de code pour un simple héritage:
Voici Macro.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
|
#ifndef MACRO_H_INCLUDED
#define MACRO_H_INCLUDED
#include "Executable.h"
#include "Robot.h"
#include <string>
#include <vector>
#include <map>
#include <iostream>
class Macro : public Executable{
private:
vector<Executable*> contenu;
public :
Macro(){};
void executer();
void desexecuter();
void ajouterExecutable(Executable* e);
void supprimerExecutable(Executable* e);
};
#endif // MACRO_H_INCLUDED |
et voici Executable.h
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
#ifndef EXECUTABLE_H
#define EXECUTABLE_H
#include "Robot.h"
#include <string>
#include <vector>
#include <map>
#include <iostream>
class Executable {
public:
Executable(){}
virtual void executer(){}
virtual void desexecuter(){}
};
#endif |
Cela me sort cette erreur :
Code:
1 2 3 4 5 6 7 8 9 10 11
| g++ -g -ansi -Wold-style-cast -Woverloaded-virtual -I -D_DEBUG_ -c Executable.cpp -o Executable.o -g -ansi -Wold-style-cast -Woverloaded-virtual;
In file included from Robot.h:20,
from Executable.h:14,
from Executable.cpp:11:
Macro.h:11: error: expected class-name before { token
Macro.h:13: error: Executable was not declared in this scope
Macro.h:13: error: template argument 1 is invalid
Macro.h:13: error: template argument 2 is invalid
Macro.h:19: error: Executable has not been declared
Macro.h:20: error: Executable has not been declared
make: *** [Executable.o] Erreur 1 |
Aussi, si je rajoute avant la déclaration de la classe Macro la ligne de code
cela me sort cette erreur:
Code:
1 2 3
| Macro.h|12|error: invalid use of incomplete type struct Executable|
Macro.h|11|error: forward declaration of struct Executable|
||=== Build finished: 2 errors, 0 warnings ===| |
Quelqu'un pourrait-il m'aider à reseoudre ce probléme?