How to define _WIN32_WINNT and WINVER?

I need to define _WIN32_WINNT and WINVER to 0x0602 (Windows 8) in order to use the Windows Bluetooth LE API. What is the correct way of doing this? Right now, I have to edit the intermediate files like SharedPCH.Engine.h and Definitions.Module.h. This isn’t ideal, because the intermediate files can be rewritten, and then I have to update them manually again.

Thanks so much for the help! I have to read up more on UBT and build configurations in general. I regret not getting an education in computer science :frowning:

Anyway, for those wondering what needs to be added to the .Target.cs files, here’s what I’ve got:

ProjectDefinitions.Remove("WINVER=0x0601");
ProjectDefinitions.Remove("_WIN32_WINNT=0x0601");
ProjectDefinitions.Add("WINVER=0x0602");
ProjectDefinitions.Add("_WIN32_WINNT=0x0602");

It works. Hopefully this is the correct way to do it.

Build is manage by UBT and whole build configuration i set in build scripts by setting properties in C# class, there 2 types of them"

For each project, a target script (*.Target.cs), you can actully have more then one for project to have diffrent kind of builds, by default there Editor target (one you build for editor use) and untitled Runtime build for packaged project. Note that this configuration will also be applied for engine build it self if you build UE4 from source:

And one per module a module script (*.Build.cs)

Both scripts types have option to set and override definitions

Hmm, turns out I’m still occasionally getting warnings about the macro redefinition. Looking at the intermediate files, there are multiple definitions. I wonder if I have to use the GlobalDefinitions list. I’m not using a source-built engine, so I can’t edit the GlobalDefinitions. It’s just a warning, though. The project still builds. Guess I can live with it until I figure out the correct way of doing it.