Shailesh Tainwala
Shailesh Tainwala

Reputation: 6507

C++ syntax error: missing ';' before 'constant'

I have the following line of code in my program -

typedef GROUP ACE_SOCK_GROUP;

That gives the following warnings and errors -

Warning 181 warning C4091: 'typedef ' : ignored on left of 'int' when no variable is declared

Error 182 error C2143: syntax error : missing ';' before 'constant'

Error 183 error C2059: syntax error : 'constant'

The definition of GROUP is given in another file that is included by my program as -

typedef unsigned int             GROUP;

I am using Visual Studio 2008 and found the definition of GROUP using the F12 function

Upvotes: 0

Views: 10581

Answers (1)

Luchian Grigore
Luchian Grigore

Reputation: 258548

The code is correct.

You're forgetting to include the file where GROUP is defined.

You can try a simple test to confirm this is the issue:

typedef unsigned int             GROUP;
typedef GROUP ACE_SOCK_GROUP;

If this compiles, and it will, that means that the previous definition of GROUP is not seen. You need to include the file with the definition before defining ACE_SOCK_GROUP.

Upvotes: 3

Related Questions