35

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;
}
Zac
  • 4,510
  • 3
  • 36
  • 44
jdl
  • 6,151
  • 19
  • 83
  • 132

3 Answers3

69

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>.

Michael Burr
  • 333,147
  • 50
  • 533
  • 760
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>
Andy Finkenstadt
  • 3,547
  • 1
  • 21
  • 25
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).

Andrejs Cainikovs
  • 27,428
  • 2
  • 75
  • 95