Bonjour à tous,
j'ai une erreur de compilation error C2061: syntax error : identifier 'Polygon'
qui pointe sur la ligne suivante dans un fichier Interface.h:
Code : Sélectionner tout - Visualiser dans une fenêtre à part void initPolygon(Polygon pl, cpSpace* space, bool inComplexShape);
voilà Interface.h où je ne mets que le code où il y a l'erreur de compilation:
Das Interface.cpp, j'ai:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 #ifndef INTERFACE_H #define INTERFACE_H //#include "CpTools.h" #include "Level.h" #include "Body.h" #include "Triangle.h" #include "Square.h" #include "Circle.h" #include "Line.h" #include "Polygon.h" #include "ComplexShape.h" #include "MoveTo.h" #include "Pivot.h" class Interface{ /// void initPolygon(Polygon pl, cpSpace* space, bool inComplexShape); /// }; #endif
La fichier de la classe Polygon est ainsi:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 #include "Interface.h" void Interface::initPolygon(Polygon pl, cpSpace* space, bool inComplexShape){ // code de la méthode }
et son .cpp est ainsi:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 #ifndef POLYGON_H #define POLYGON_H #include "BasicShape.h" #include "Point.h" class Polygon : public BasicShape{ public: Polygon(); void addPoint(Point new_point); vector <Point> getPointList(); int getNbPoints(); string myType(); private: vector <Point> points; }; #endif
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 #include "Polygon.h" Polygon::Polygon() : BasicShape(){} void Polygon::addPoint(Point new_point){ points.push_back(new_point); } vector <Point> Polygon::getPointList(){ return points; } int Polygon::getNbPoints(){ return points.size(); } string Polygon::myType(){ return "polygon"; }
apparemment le compilateur ne connaît pas Polygon mais je ne comprends vraiment pas pourquoi.
Merci d'avance pour votre aide
Partager