Getting error when compiling the engine!

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Erdo

When I type: scons -j6 platform=windows target=release_debug

I get this error:

C:\Users\Burak\Desktop\Build Godot\godot>scons -j6 platform=windows target=release_debug
scons: Reading SConscript files ...
Configuring for Windows: target=release_debug, bits=default
Found MSVC compiler: amd64
Compiled program architecture will be a 64 bit executable (forcing bits=64).
Missing environment variable: WindowsSdkDir
Missing environment variable: WindowsSdkDir
YASM is necessary for WebM SIMD optimizations.
WebM SIMD optimizations are disabled. Check if your CPU architecture, CPU bits or platform are supported!
Checking for C header file mntent.h... (cached) no
scons: done reading SConscript files.
scons: Building targets ...
[Initial build] e[94mCompiling e[95m==> e[93mplatform\windows\godot_windows.cppe[0m
[Initial build] e[94mCompiling e[95m==> e[93mplatform\windows\camera_win.cppe[0m
[Initial build] e[94mCompiling e[95m==> e[93mplatform\windows\context_gl_windows.cppe[0m
godot_windows.cpp
camera_win.cpp
context_gl_windows.cpp
[Initial build] e[94mCompiling e[95m==> e[93mplatform\windows\crash_handler_windows.cppe[0m
crash_handler_windows.cpp
[Initial build] C:\Users\Burak\Desktop\Build Godot\godot\core/typedefs.h(34): fatal error C1083: Cannot open include file: 'stddef.h': No such file or directory
C:\Users\Burak\Desktop\Build Godot\godot\core/math/random_pcg.h(34): fatal error C1083: Cannot open include file: 'math.h': No such file or directory
[Initial build] e[94mCompiling e[95m==> e[93mplatform\windows\os_windows.cppe[0m
[Initial build] e[94mCompiling e[95m==> e[93mplatform\windows\key_mapping_windows.cppe[0m
os_windows.cpp
key_mapping_windows.cpp
scons: *** [platform\windows\godot_windows.windows.opt.tools.64.obj] Error 2
scons: *** [platform\windows\camera_win.windows.opt.tools.64.obj] Error 2
C:\Users\Burak\Desktop\Build Godot\godot\core/typedefs.h(34): fatal error C1083: Cannot open include file: 'stddef.h': No such file or directory
C:\Users\Burak\Desktop\Build Godot\godot\core/typedefs.h(34): fatal error C1083: Cannot open include file: 'stddef.h': No such file or directory
scons: *** [platform\windows\context_gl_windows.windows.opt.tools.64.obj] Error 2
scons: *** [platform\windows\key_mapping_windows.windows.opt.tools.64.obj] Error 2
C:\Users\Burak\Desktop\Build Godot\godot\core/typedefs.h(34): fatal error C1083: Cannot open include file: 'stddef.h': No such file or directory
scons: *** [platform\windows\os_windows.windows.opt.tools.64.obj] Error 2
C:\Users\Burak\Desktop\Build Godot\godot\platform\windows\crash_handler_windows.h(34): fatal error C1083: Cannot open include file: 'windows.h': No such file or directory
scons: *** [platform\windows\crash_handler_windows.windows.opt.tools.64.obj] Error 2
scons: building terminated because of errors.

I installed Windows SDK and created System variable Name: WindowsSdkDir Value: C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt
But I still get this error…

Did you install Visual Studio as specified in these docs?

Kyle Guarco | 2019-06-24 18:41

:bust_in_silhouette: Reply From: gamepad_coder

[ November 2020 ]

Windows 10.
Compiling with SCons command in Powershell.


Issue I ran into:


I installed Visual Studio Community 2019

  • installed the Visual Studio “Workload” named Desktop development with C++.

I tried to compile Godot with scons platform=windows
but got this error :

Cannot open include file: ‘stddef.h’: No such file or directory

Reinstalling Visual Studio’s Desktop development with C++ solved this, and Godot immediately compiled.


Here's the full recipe I used, hopefully this will save someone time:
Compiling Godot on Windows 10: --
  1. Install Visual Studio Community 2019
    Visual Studio 2022 Community Edition – Download Latest Free Version .

  2. Install Visual Studio’s Desktop development with C++ Workload.
  • during VS 2019 Installation :
    Click Desktop development with C++ before you click Install
  • or after VS 2019 is installed :
    a. Click Start in the Windows Taskbar
    b. Type “Visual Studio Installer” without quotes and hit enter.
    c. Click “Modify” next to “Visual Studio Community 2019”.
    d. Click Desktop development with C++ on the “Workloads” tab.
    e. Install by clicking Modify in the bottom-right corner.
    f. Close Visual Studio Installer when it’s finished.

  1. Install Chocolatey Chocolatey Software | Installing Chocolatey

  2. Open Powershell & run :
  • choco install python3
  • python -m pip install --upgrade pip
  • python -m pip install scons
  • choco install yasm
  • scons platform=windows -j6

    ( or if you only have a few cores in your CPU
    scons platform=windows )

  1. Enjoy Godot!


You might need to close and open a fresh instance
of Powershell in between each command of step [4]
.

You don’t have to use Chocolatey, but I’ve found it to be convenient, hassle-free, and a huge time-saver.


**More Info:**

From Compiling for Windows — Godot Engine (3.2) documentation in English :

Docs : Development : Compiling : Compiling for Windows
“SCons will automatically find and use an existing Visual Studio installation. If you do not have Visual Studio installed, it will attempt to use MinGW instead.”

If you type scons platform=windows after following the above steps, SCons will use Visual Studio to compile Godot. Add the -j# parameter to the scons command to use multiple CPU threads.