When trying to build a C++ GDExtension through SCons i am getting next error:
scons: Reading SConscript files ...
Auto-detected 2 CPU cores available for build parallelism. Using 2 cores by default. You can override it with the -j argument.
Building for architecture x86_64 on platform windows
scons: done reading SConscript files.
scons: Building targets ...
g++ -o src\godot.windows.template_debug.x86_64.o -c -fno-exceptions -std=c++17 -Wwrite-strings -O2 -fvisibility=hidden -DHOT_RELOAD_ENABLED -DWINDOWS_ENABLED -DDEBUG_ENABLED -DDEBUG_METHODS_ENABLED -DNDEBUG -Igdextension -Iinclude -Igen\include src\godot.cpp
g++ -o src\classes\editor_plugin_registration.windows.template_debug.x86_64.o -c -fno-exceptions -std=c++17 -Wwrite-strings -O2 -fvisibility=hidden -DHOT_RELOAD_ENABLED -DWINDOWS_ENABLED -DDEBUG_ENABLED -DDEBUG_METHODS_ENABLED -DNDEBUG -Igdextension -Iinclude -Igen\include src\classes\editor_plugin_registration.cpp
scons: *** [src\godot.windows.template_debug.x86_64.o] The system cannot find the file specified
scons: *** [src\classes\editor_plugin_registration.windows.template_debug.x86_64.o] The system cannot find the file specified
scons: building terminated because of errors.
I wasn’t able to find same errors anywhere else, or what src\godot.windows.template_debug.x86_64.o file is. Any clues?
If that doesn’t get it working, can you share what GDExtension you’re trying to build, and can you show the scons command you used to generate the log you shared? (i.e. was it just scons alone, or did you pass any flags or arguments?)
Those export templates were already downloaded for me through engine (Editor → Manage Export Templates), do I have to do anything with them past that? Wouldn’t they be only used when exporting a game?
I’m pretty new to Godot myself and mainly just did a bit of reading of the engine code and docs to try to answer this. I could be misunderstanding here… but it does seem that those templates are being used for more than just exporting the game. Your error log definitely seems to indicate that scons is looking for those templates and not finding them.
Maybe downloading the export templates through the editor doesn’t put them in a place that the GDExtension build process recognizes? Going by the documentation, it may be expecting to find these files in a clone or submodule of the godot-cpp git repository:
Hey so I had the same issue. make sure you have g++ installed. The error is telling you that it is looking for a file that cannot be found. The file it is looking for is the file it is trying to create on the line that starts with g++.
So your gonna have to make sure you have g++ compiler installed and set to your syst env variable. here is a link that helped guide me and fixed it for me. How to Install C and C++ Compilers on Windows
-oh and make sure you are using target=template_release in your command
The error isn’t related to templates and I don’t believe it’s an error with the compiler. The file ending in .o is an object file. The file it’s looking for should have been generated when godot-cpp was compiled.
Does src/godot.windows.template_debug.x86_64.o exist in your godot-cpp folder? If not, you may want to try compiling godot-cpp apart from the project. This can be done by running scons in the godot-cpp folder.
What does your project’s SConstruct file look like? What is the location of your godot-cpp folder?
I did most of the stuff written in the tutorial by myself, but what tutorial pointed out that I forgot to do was to add ..\msys64\mingw64\bin to Path variable. After that, both gcc and g++ could be run anywhere and scons started working in godot-cpp.