> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# GDK on XBOX preprocessor definitions

> Microsoft Game Development Kit on XBOX preprocessor definitions

This article lists the preprocessor definitions that are specific to the Microsoft Game Development Kit (GDK) on XBOX.

| Preprocessor define                           | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| --------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| \_GAMING\_XBOX                                | The official define for XBOX One or XBOX Series X\|S. #ifdef \_GAMING\_XBOX // Microsoft Game Development Kit (GDK) on XBOX. ...                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| \_GAMING\_XBOX\_XBOXONE                       | The define indicates building on the GDK on XBOX One.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| \_GAMING\_XBOX\_SCARLETT                      | The define indicates building on the GDK on XBOX Series X\|S.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| \_GAMING\_DESKTOP                             | The define indicates building on PC with the GDK.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| \_M\_X64, \_M\_IX86, \_M\_ARM64, and \_M\_ARM | When writing code that's specific to the processor architecture rather than the platform, use these defines. For XBOX 360, the equivalent define is \_M\_PPCBE. \_M\_AMD64 is an alias for \_M\_X64 and was the original name. It's being phased out in favor of \_M\_X64. Don't use the Windows legacy defines, such as *X86* and *AMD64*.                                                                                                                                                                                                                                                                                                   |
| WINAPI\_FAMILY                                | The Microsoft platform headers make extensive use of the Windows family and partition macros that are defined in winapifamily.h. Remember that the partitions can (and in fact do between Windows 8.0 SDK and Windows 8.1 SDK) change. There are also new PARTITION and FAMILY values added over time. Client code should never make direct use of the PARTITION values, the WINAPI\_FAMILY\_PARTITION macro, or the WINAPI\_FAMILY\_ONE\_PARTITION macro. It's reasonable for client code to look for specific values of WINAPI\_FAMILY. The Windows 8.1 SDK version of winapifamily.h has an expanded comment block that covers this usage. |

Use the following preprocessor definitions for Microsoft Game Development Kit (GDK) on XBOX code.

```cpp theme={null}
#ifdef _GAMING_XBOX
// GDK on Xbox
```

```cpp theme={null}
#ifdef _GAMING_XBOX_SCARLETT
// Xbox Series X|S hardware
#elif _GAMING_XBOX_ONE
// Xbox One hardware
```

When you build by using the Microsoft Game Development Kit (GDK), the Visual Studio integrated development environment (IDE) Microsoft Build rules automatically define `_GAMING_XBOX` and `WINAPI_FAMILY=WINAPI_FAMILY_GAMES`. Developers who don't use the Visual Studio IDE to build against the Microsoft Game Development Kit (GDK) must supply these values on the compiler command-line.

## Gaming.Xbox.XboxOne.x64

```
/D_GAMING_XBOX /D_GAMING_XBOX_XBOXONE /DWINAPI_FAMILY=WINAPI_FAMILY_GAMES  
```

## Gaming.Xbox.Scarlett.x64

```
/D_GAMING_XBOX /D_GAMING_XBOX_SCARLETT /DWINAPI_FAMILY=WINAPI_FAMILY_GAMES  
```

## Gaming.Desktop.x64

```
/D_GAMING_DESKTOP /DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP
```

> These defines also apply to 'classic' x64 platforms when you use the Microsoft Game Development Kit.

When you write Microsoft cross-platform code, you can use the following construction.

```cpp theme={null}
    #if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP)
    // This code is for Win32 desktop apps.
    #elif WINAPI_FAMILY == WINAPI_FAMILY_GAMES
    // This code is for the Microsoft Game Development Kit (GDK) (could also use _GAMING_XBOX if only targeting Xbox).
    #elif WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
    // This code is for Windows phone 8.x.
    #elif WINAPI_FAMILY == WINAPI_FAMILY_APP
    // This code is for Microsoft Store apps for 8.x.
    #elif WINAPI_FAMILY == WINAPI_FAMILY_TV_TITLE
    // This code is for Xbox One Game OS/XDK.
    #elif WINAPI_FAMILY == WINAPI_FAMILY_TV_APP
    // This code is for Xbox One System OS/ADK.
    #else
    #error Unknown WINAPI_FAMILY value
    #endif  
```


## Related topics

- [Visual Studio (contents)](/tools/tools-pc/visualstudio/gr-visualstudio-toc.md)
- [Configure Visual Studio for XBOX Series X|S and XBOX One](/tools/tools-console/visualstudio/vs-cross-gen.md)
- [Simplified GDK directory structure (headers and libraries)](/build/gdk-and-engines/guides/gdk-directory-structure.md)
- [Use Clang/LLVM with the GDK](/tools/tools-pc/visualstudio/gr-vs-clang.md)
- [Visual Studio for console development](/tools/tools-console/visualstudio/visualstudio.md)
