33

I get the following error with a Windows file when compiling winbase.h.

Not sure why I get a syntax error and the compiler shows many more:

1> c:\program files\microsoft sdks\windows\v6.0a\include\winbase.h(238) : 
   error C2146: syntax error : missing ';' before identifier 'Internal'

Here a simple code to reproduce the problem:

#include <winbase.h>

int main()
{
    return 0;
}
11
  • 7
    It seems you're missing a semi-colon.
    – Falmarri
    Sep 7, 2011 at 21:30
  • 3
    Can you please post some of the code? With just this error, it's hard to know what's wrong. Sep 7, 2011 at 21:31
  • 3
    You're probably missing a semi-colon right before you (in)directly included "winbase.h".
    – Mysticial
    Sep 7, 2011 at 21:32
  • 4
    Not sure why this is ruled as "not a real question". Given that it has a correct, up-voted answer, it sure seems like a real question to me. May 7, 2012 at 21:13
  • 2
    Even though this question was closed as "not a real question", MSDN lists Winbase.h as the file to include for using certain functions, so this question and answer was very helpful.
    – simpleuser
    Mar 10, 2016 at 17:15

3 Answers 3

65

Are you including <winbase.h> directly?

You shouldn't - it expects to have some things defined/declared before it's processed. Specifically in this case the identifier ULONG_PTR which is declared as a typedef in intsafe.h.

Include <windows.h>.

3

You are probably missing a ; immediate before the #include <windows.h> line in your code. Alternatively, there is some identifier-like text preceding the include file line.

int ABC
#include <windows.h>
1

If your code is fine, and there is no missing semicolons before #include "winbase.h" then it should be a missing include before winbase.h (or one of the files that includes it).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.