Prompt
Which C++ library should I use for Godot?
Latest observation
For C++ development with Godot, you should use godot-cpp, the official C++ bindings for Godot’s GDExtension API.
Recommended library: godot-cpp
- godot-cpp is the officially maintained C++ binding layer that lets you write GDExtensions in C++ without recompiling the engine.
- It mirrors Godot’s internal C++ API closely, so if you know how things work in GDScript/C#/engine docs, the C++ usage feels very similar.
- It supports all the scripting-level features GDScript and C# have, plus some extra low‑level access for performance‑critical code.
When to use godot-cpp vs C++ modules
Godot supports two main ways to use C++:
-
GDExtension + godot-cpp (recommended for most games/plugins)
-
You compile your code as a dynamic library (.dll/.so/.dylib).
-
No need to rebuild Godot itself.
-
Easy to distribute and update.
-
Works with any C++ compiler/version thanks to the C API bridge.
-
C++ modules (advanced, engine‑level work)
-
You modify and recompile the Godot engine source.
-
Gives deeper integration (e.g., new engine subsystems, editor extensions that need tight coupling).
-
More complex build and distribution.
For typical game logic, custom nodes, performance‑critical systems, or third‑party library bindings, godot-cpp + GDExtension is the right choice.
Basic setup outline
Typical workflow:
- Add
godot-cppas a submodule or dependency in your project. - Generate the extension API JSON from your Godot version:
godot --dump-extension-api
- Build godot-cpp against that API using SCons:
cd godot-cpp
scons platform=<your_platform> custom_api_file=../extension_api.json
- Write your C++ classes using
godot-cpp, register them withGDCLASS,_bind_methods, andClassDB, then compile your extension as a shared library.
If you tell me your Godot version (e.g., 4.3, 4.4) and target platform, I can give exact commands and a minimal project layout.
Citations
- https://docs.godotengine.org/en/4.7/tutorials/scripting/cpp/about_godot_cpp.html
- https://dev.to/gustavolr548/programming-with-gdextension-high-performance-c-in-godot-4-part-1-3c19
- https://docs.godotengine.org/en/3.1/development/cpp/custom_modules_in_cpp.html
- https://github.com/godotengine/godot-cpp
- https://docs.godotengine.org/en/stable/tutorials/scripting/cpp/core_types.html
- https://docs.godotengine.org/en/stable/getting_started/step_by_step/scripting_languages.html
- https://docs.godotengine.org/en/stable/engine_details/development/compiling/compiling_for_windows.html
- https://docs.godotengine.org/en/latest/tutorials/scripting/cpp/gdextension_cpp_example.html
- https://contributing.godotengine.org/en/latest/development/engine/cpp_usage_guidelines.html
- https://github.com/godotengine/godot-cpp/tree/3.5