简体   繁体   中英

Compile errors from winnt.h, winbase.h, and excpt.h for windows mobile project

I have desktop project which is compiled successfully, but after I add new configuration to the project to support Windows Mobile platforms, I receive the following errors:

error C2146: syntax error : missing ';' before identifier 'ContextRecord' winnt.h
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int winnt.h

error C2146: syntax error : missing ';' before identifier 'LPCONTEXT'   winbase.h
error C2040: 'PCONTEXT' : '_CONTEXT *' differs in levels of indirection from 'int'  excpt.h

The project does not include winnt.h, but it includes windows.h, windbase.h. I search on google that I have to change Project properties->configuration properties->C/C++->Preprocessor->definitions to add like _MBCS, or add $( ARCHFAM ), $(ARCHFAM). Or change the order of the header files which I have done that too by putting windows.h on the top of other header files, but all not fixing the errors.

Any suggestion that I can fix these? thanks.

#include<windows.h> out of all 3 of those, windows.h drags them all in. This is the only include you need. it covers 80 percent of all windows api's , minus some specialized discrete aspects of the os (such as direct 2d, encryption, ect)

I got these errors too. My problem was that I forgot a ";" behind my class defintion in one of my header files.

Instead of:

class myClass
{
   ...
};

I had:

class myClass
{
    ...
}

Maybe it helps someone...

It is necessary to correct manually a syntactic mistake in a file winnt.h

Line: typedef void *POINTER_64 PVOID64;

We correct: typedef void *POINTER_64, *PVOID64;

Or on two: typedef void *POINTER_64; typedef void *PVOID64;

Errors disappear

I had windows.h in my dll header file.
Moved it out of the header file and into only the .cpp projects that require windows.h in and it worked.

The console test app for the DLL got mad when it tried to include a bunch of windows stuff.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM