VS gone mental

I'm using Visual Studio 2008 Express and up until about 2 minutes ago it worked fine. I'm including a header called psapi.h, and last night throughout this morning, it worked fine. Now I'm getting like 176 compiling errors coming from psapi.h

I could post the messages, but upon investigation, the psapi file has the return types and whatnot each on their own line, then the function on it's own line, for example:

1
2
3
4
5
6
7
BOOL
WINAPI
EnumProcesses (
    __out_bcount(cb) DWORD * lpidProcess,
    __in DWORD cb,
    __out LPDWORD lpcbNeeded
    );


And that's what it seems to be freaking out about. Here's a few error messages pertaining to the above code. By the way, line one is 41, line two is 42, and so on:

1
2
3
4
5
6
7
8
9
1>g:\program files\microsoft sdks\windows\v6.0a\include\psapi.h(43) : error C2146: syntax error : missing ';' before identifier 'WINAPI'
1>g:\program files\microsoft sdks\windows\v6.0a\include\psapi.h(43) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>g:\program files\microsoft sdks\windows\v6.0a\include\psapi.h(43) : error C2146: syntax error : missing ';' before identifier 'EnumProcesses'
1>g:\program files\microsoft sdks\windows\v6.0a\include\psapi.h(43) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>g:\program files\microsoft sdks\windows\v6.0a\include\psapi.h(44) : error C2065: 'cb' : undeclared identifier
1>g:\program files\microsoft sdks\windows\v6.0a\include\psapi.h(44) : error C3861: '__out_bcount': identifier not found
1>g:\program files\microsoft sdks\windows\v6.0a\include\psapi.h(44) : error C2146: syntax error : missing ')' before identifier 'DWORD'
1>g:\program files\microsoft sdks\windows\v6.0a\include\psapi.h(44) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>g:\program files\microsoft sdks\windows\v6.0a\include\psapi.h(47) : error C2059: syntax error : ')'


I gives similar errors for every function found in psapi.h. I don't know why that's a problem, or why the psapi file is set up like that, but that's what's going on.

How do I fix this?
Last edited on
I think the problem is that you're not including "windows.h". Once I included that, the errors went away. I think it was complaining about the type WINAPI which it didn't know about (i.e. I think "windows.h" includes other headers where these required types are defined). Does anyone have any comments on this?
Ooohhh.

Actually, I had it included, but I rearranged my includes in alphabetical order, so it was included after the psapi. Once I included it before the psapi, the errors went away.

Thanks for the suggestion.
Topic archived. No new replies allowed.