简体   繁体   中英

_WIN32_WINNT Not defined

I had a problem with using winternl.h , I was using some of the datatypes out of there and have sucessfully compiled it for x64 without any problems. However I made some changes and now for some reason its failing to compile, through debugging I've found that the reason seems to be down to _WIN32_WINNT not being defined at all which causes winternl.h to not define any types. It was specifically this that was causing the problem with the PEB struct

EXTERN_C PEB* NTAPI RtlGetCurrentPeb(VOID);

Now the only thing I've seemingly changed is removing precompiled headers and creating a new class. Neither of which had the define for _WIN32_WINNT . I've created a brand new project copied the class that imported winternl.h over and compiled it fine. Everything is the same, imports, includes and libs etc. I can't get my head around what I did to cause this to not be defined. I've spent ages going over the two projects and cant find a cause for the problem.

I can upload the code to pastebin if need be however as both classes are the same in each project I shouldnt think this should make a difference. I guess I must of messed with something in the projects settings but I can't figure out what that may be

_WIN32_WINNT comes from the include file <windows.h> , so in order to fix the error you are seeing:

In the file throwing the error, change this:

#include <winternl.h>

// ...

to this:

#include <windows.h>
#include <winternl.h>

// ...

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