Code::Blocks error: expected '=', ',', ';', 'asm' or '_attribute_' before 'CGraphics"

What does this error even mean? Here's the CGraphics.h file:

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 CGRAPHICS_H
#define CGRAPHICS_H

#include <GL/gl.h>
#include <windows.h>

class CGraphics
{
    public:
        CGraphics();
        ~CGraphics();
        CGraphics( const CGraphics& other );
        CGraphics& operator=( const CGraphics& other );
        void make3D( bool );
        void move( int, int );
        void move( int, int, int );
        int gexX() {return x;};
        int getY() {return y;};
        int getZ() {return z;};
    protected:
        int x, y, z;
        bool is3D;
};

#endif // CGRAPHICS_H 


I also get that error with my CRectangle class, which inherits from CGraphics. Near as I can tell, it's saying that there's something wrong with my class declaration, but I have no idea what. Does anyone know what this error means or, more importantly, how to make it go away and never come back?
If you're not using headers don't include them. I have a slight idea that maybe through the evilness of windows.h and the randomness of openGL that CGraphics already exists...
I tried removing those includes but I still get the same error, so it's probably not that. I'm somewhat familiar with the OpenGL library and I'm fairly sure that there's nothing titled CGraphics in it, but idk anything about windows.h. I'll try renaming everything and hope that works.

I changed my class names from CGraphics and CRectangle to Graphics2D and Rectangle, respectively, and I'm still getting the same error.
Last edited on
closed account (zb0S216C)
This might be a result of an incorrect extension. Make sure that your source file's extension is .CPP. If the file has a .C extension, the compiler will interpret the source file as C code, not C++.

Wazzak
Last edited on
Yeah, they're all .cpp, except for the main file generated when I started this project, which is .c. Would that matter?
closed account (zb0S216C)
Yes, it does. A C++ project must have all .CPP extensions.

Wazzak
Thanks. That fixed my problem perfectly. Thank you.
Topic archived. No new replies allowed.