Example GDExtension derived from the Official guide and godot-cpp-template.
This project is intended for reference only
- Godot v4.2+
- a C++ compiler
- Build tools:
- Scons
- Make
Official list of prerequisites
See also Compiling as the build tools are identical to the ones you need to compile Godot from source.
The Makefile defines targets for building based on the OS and debug vs release.
Run make help for a list of targets and descriptions.
2024.02.24:
When using the Makefile to build the gdextension with debug there will be a stack smashing error when the extension is loaded if two scons commands are run sequentially.
Remove one scons command from the debug and Godot will load the extension without issue. You can even run the removed command manually and everything should still work (based on my testing).
This bug only afflicts the debug builds, as additional memory checks are being enabled.
Steps to reproduce:
- Clone the repository or run
make cleanto clear build artifacts. - Build the godot_cpp library (e.x.,
make godot_cpp_linux). - Build the GDExtension (e.x.,
make gdextension_linux_debug). - Load Godot
Expected results:
Blank project loads extension and ready to create.
Actual results:
Stack smashing error, process terminated