# How to define \_WIN32\_WINNT and WINVER?

**URL:** <https://forums.unrealengine.com/t/how-to-define-win32-winnt-and-winver/460549>\
**Category:** C++\
**Tags:** unreal-engine, question, CPP\
**Created:** [January 14, 2020, 6:03am UTC](https://forums.unrealengine.com/t/how-to-define-win32-winnt-and-winver/460549 "2020-01-14T06:03:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![vle07](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@vle07](https://forums.unrealengine.com/u/vle07)\
**Post date:** [January 14, 2020, 6:03am UTC](https://forums.unrealengine.com/t/how-to-define-win32-winnt-and-winver/460549/1 "2020-01-14T06:03:05Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Shadowriver](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shadowriver](https://forums.unrealengine.com/u/Shadowriver)\
**Post date:** [January 14, 2020, 6:30am UTC](https://forums.unrealengine.com/t/how-to-define-win32-winnt-and-winver/460549/2 "2020-01-14T06:30:01Z")

</div>

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:

> **[Targets](https://docs.unrealengine.com/5.1/en-US/unreal-engine-build-tool-target-reference/)**
>
> An overview of UBT Targets, including property descriptions.

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

> **[Module Properties](https://docs.unrealengine.com/5.1/en-US/module-properties-in-unreal-engine/)**
>
> An overview of Unreal Build Tool Modules, including property descriptions.

Both scripts types have option to set and override definitions

---

<div class="post-metadata">

**Author:** ![vle07](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@vle07](https://forums.unrealengine.com/u/vle07)\
**Post date:** [January 14, 2020, 7:46am UTC](https://forums.unrealengine.com/t/how-to-define-win32-winnt-and-winver/460549/3 "2020-01-14T07:46:50Z")

</div>

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 ☹

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.

---

<div class="post-metadata">

**Author:** ![vle07](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@vle07](https://forums.unrealengine.com/u/vle07)\
**Post date:** [January 15, 2020, 1:23am UTC](https://forums.unrealengine.com/t/how-to-define-win32-winnt-and-winver/460549/4 "2020-01-15T01:23:13Z")

</div>

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.
