I just switched from windows (Visual Studio) to Linux (Mint) and now I’m using QTCreator for plain c++ projects. Though everything seems to be working fine when I try to compile the project I was working on with VS2010, g++ won’t accept the following syntax.
enum{
LINE,
POLYGON,
TRIANGLE
}Shapes;
… much code …
gEngine.AddItem(1,0,Shapes::POLYGON,0,0,0);
gEngine.AddItem(1,2,Shapes::POLYGON,400,400,-1);
gEngine.AddItem(1,2,Shapes::POLYGON,800,400,-1);
gEngine.AddItem(1,2,Shapes::POLYGON,800,800,-1);
gEngine.AddItem(1,2,Shapes::POLYGON,400,800,-1);
gEngine.AddItem(1,2,Shapes::POLYGON,400,400,-1);
gEngine.AddItem(1,1,Shapes::POLYGON,0,0,0);
(G++) Returning: Shapes is not a class or a namespace ; even though it compiles perfectly with VS2010.
There is no type
Shapesbut you have declared a variable calledShapes.To define the type use
enum Shapes {...}then create variables of that type.