Click here to Skip to main content
15,881,380 members
Please Sign up or sign in to vote.
1.50/5 (2 votes)
See more:
Hi all

I have a problem in my code
the static constant variable error it gives me error missing ; before constant how to solve this issue

Regards
Posted
Updated 19-Apr-12 19:21pm
v2
Comments
Lakamraju Raghuram 20-Apr-12 1:20am    
Give the required code snippets
Prasad_Kulkarni 20-Apr-12 1:22am    
Dont use BLOCK letters in your post, it considered as shouting.
Removed shouting.
Prasad_Kulkarni 20-Apr-12 1:23am    
Please provide some code..
Argonia 20-Apr-12 1:44am    
check the line before the constant i am guessing you forgot the ; before the declaration of it
Rahul Rajat Singh 20-Apr-12 1:46am    
please post the code snippet that is causing the error.

1 solution

Compiler errors like this usually point to a syntax error in the previous line(s). Fixing it may be as easy as appending a ; , like suggested above. But your error message sounds more like there is a syntax error in that actual line.

You mentioned a static constant variable, that would be a constant declared within a class (or struct) like this:
C++
class Foo {
public:
   static const int bar;
};

To define that constant, your source code must assign that constant like this:
C++
const int Foo::bar = 7;

Is that what you did? Did you use the same syntax? Maybe you forgot the =? If that is not it, please post the code that causes the problem.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900