You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Windows SDK defines CONNECT_DEFERRED as a hex value with a preprocessor statement in winnetwk.h. However, Godot’s Object class uses it as an enum value name inside ConnectFlags.
A fix is present inside godot_cpp/core/defs.hpp: #undef CONNECT_DEFERRED // override from Windows SDK, clashes with Object enum
The issue is that the header is #pragma once, meaning that if defs.hpp is ever included before the Windows SDK, the fix stops working because the header can't be included again. In a large codebase, making sure that the right include order is respected everywhere is a very complex task.
A way to make this fix more reliable would be to move the #undef statements inside defs.hpp to another header that doesn't have a #pragma once directive. They are already guarded by #ifdef clauses, so this should be okay in theory.
Steps to reproduce
Include any Godot header that has godot_cpp/core/defs.hpp in its include chain
Include Windows.h
Include godot_cpp/core/defs.hpp
Try to use CONNECT_DEFERRED: Windows's define hasn't been undefined by defs.hpp
Minimal reproduction project
Compile with scons, the following errors are thrown:
'constant': illegal token on right side of '::'
type 'unknown-type' unexpected
See src\example_class.h for the problematic code and explanation comments.
I'm not sure this is something we can fully handle on the godot-cpp side, since godot-cpp isn't the one including windows.h. If someone builds a GDExtension and they are including windows.h, I think the only fully reliable fix is making sure windows.h is included before any godot-cpp headers. We could consider switching defs.hpp back from #pragma once to using header guards (and maybe put the #undef outside of them), but that'll only improve things in a couple situations, not all of them
Activity
dsnopek commentedon Feb 23, 2026
Thanks for the report!
I'm not sure this is something we can fully handle on the godot-cpp side, since godot-cpp isn't the one including
windows.h. If someone builds a GDExtension and they are includingwindows.h, I think the only fully reliable fix is making surewindows.his included before any godot-cpp headers. We could consider switchingdefs.hppback from#pragma onceto using header guards (and maybe put the#undefoutside of them), but that'll only improve things in a couple situations, not all of them