Can't open dynamic library of a GDExtension module. Not a valid win32 application

I am following the docs tutorial to build and use GDExtension modules with C++. I downloaded the godot-cpp repository and followed every step correctly until I had to compile the module using the scons file provided in the tutorial. It seemed curious to me that in this step, it built not just the module, but also the whole godot-cpp static library (a lot of time, I’m using MinGW. May this be a clue for the mistake I commited, or that’s how this is intended to be?) Anyways, at this point I had the project’s directory tree as indicated in the tutorial:

gdextension_cpp_example/
±-demo/ # game example/demo to test the extension
| ±-main.tscn
| ±-bin/
| | ±-gdexample.gdextension
±-godot-cpp/ # C++ bindings
±-src/ # source code of the extension we are building

but when I open the project in godot, the GDExample node doesn’t appear, and instead it throws me this error:

Can’t open dynamic library: D:/Aplicaciones/Godot_v4.2.1-stable_win64.exe/gdextension_cpp_example/demo/bin/~libgdexample.windows.template_debug.x86_64.dll. Error: Error 193: %1 is not a valid Win32 application
core/extension/gdextension.cpp:719 - GDExtension dynamic library not found: D:/Aplicaciones/Godot_v4.2.1-stable_win64.exe/gdextension_cpp_example/demo/bin/~libgdexample.windows.template_debug.x86_64.dll
Failed loading resource: res://bin/gdexample.gdextension. Make sure resources have been imported by opening the project in the editor at least once.

Although the dll’s name in the bin subdirectory for the windows.debug.x86_64 target is exactly the same as it appears in gdexample.gdextension (just without the “~” character that I don’t know why it’s shown in the error message). Why is this happening? I would appreciate your help

1 Like