0

I am not able to get out of these simple bugs, but would be great full if some one could answer to weed out from these errors. I included windows.h and some other necessary headers but couldn't able get out of it.

Snippet of errors:

error C2146: syntax error : missing ';' before identifier 'MMVERSION' error C4430: missing type specifier - int assumed. Note: C++ does not support default-int error C4430: missing type specifier - int assumed. Note: C++ does not support default-int error C2143: syntax error : missing ';' before '*' error C4430: missing type specifier - int assumed. Note: C++ does not support default-int error C2146: syntax error : missing ';' before identifier 'ms' error C4430: missing type specifier - int assumed. Note: C++ does not support default-int error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 

Thanks In Advance

2 Answers 2

6

To expand on Anton's answer: windows.h #defines UINT to be unsigned int. That's a C macro define, not a typedef. If you #include windows.h before you #include mmsystem.h the line he points to will be read as:

typedef unsigned int MMVERSION; 

However, if you do it the wrong way 'round, then UINT will expand to nothing, and that line will become:

typedef MMVERSION; 

That isn't valid C++ and you will get a parse error. Which is exactly what you're getting.

Sign up to request clarification or add additional context in comments.

Comments

3

Look in mmsystem.h, lines 112 and 113:

#ifdef _WIN32 typedef UINT MMVERSION; /* major (high byte), minor (low byte) */ 

So be sure to include windows.h befor including mmsystem.h, and if it does not help, try #defineing _WIN32 manually.

1 Comment

Usually all you need to do is #define WIN32 and the headers will take care of it for you.