Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

C2059: syntax error : 'constant'

Status
Not open for further replies.

fabien

Technical User
Sep 25, 2001
299
AU
c:\mydocuments\programming\c++\camera\clight.h(12) : error C2059: syntax error : 'constant'

what the heck does this mean??

pointing at first line of my CLIGHT class declaration

Code:
#ifndef CLightH 
#define CLightH 

class CLIGHT : public OBJECT 
{ 
public: 
CLIGHT(); 
~CLIGHT(); 

GLvoid Reset(); 
GLvoid Update(); 
GLvoid Apply(); 
}; 

#endif

which is derived from object class. I have another class derived from object called camera and it is the same as CLIGHT and I don't get the error!!! Can't I create multiple derived class from the same one?

Thanks for your help
 
From what I understand, the problem is at the line
class CLIGHT : public OBJECT

MSDN says that:
"syntax error : 'token'

The token caused a syntax error. Problems of this type can sometimes be attributed to a syntactical or clerical error."

So there must be a constant there that is not right.
Do you have a constant defined somewhere in an included file or in the given file?

Take care, because the line that produces the error can be before the line 12. I am almost sure that it is. So check there.
 
do you include any files before the class declaration? Especially the class header where "OBJECT" is declared. Also, with that error, it sort-of seems like "OBJECT" was #define'ed to a value and that value is being replaced. Preprocessor resulting errors are a pain. If all else fails, remove the inheritance and see if it compiles.

Matt
 
Yes I do include several files (including object.h) , but I had a look in them and there are no mentions of CLIGHT in them. I have tried removing them and I get more errors. I'll try to remove the inheritance..
 
I just removed the inheritance and I don't get this error anymore. As I said before I have created another derived class (Camera class) which is very similar and there is no problem with it...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top