Fatal error C1083: Cannot open include file: 'Godot.hpp': No such file or directory
I'm using GDNative documentation of Godot 3.2 and I'm stuck on this section (Compiling the Plugin): https://docs.godotengine.org/en/3.2/tutorials/plugins/gdnative/gdnative-cpp-example.html#compiling-the-plugin
Here's the build log:
scons: Reading SConscript files ... scons: done reading SConscript files. scons: Building targets ... scons: `bin\libgodot-cpp.windows.debug.default.lib' is up to date. cl /Fosrc\gdexample.obj /c src\gdexample.cpp /TP /nologo -W3 -GR -EHsc -MDd -ZI /DWIN32 /D_WIN32 /D_WINDOWS /D_CRT_SECURE_NO_WARNINGS /D_DEBUG /I. /Igodot-cpp\godot_headers /Igodot-cpp\include /Igodot-cpp\include\core /Igodot-cpp\include\gen /Isrc gdexample.cpp e:\godot\godot 3.2\projects (own)\gdnative c++ based on documents\gdnative_cpp_example\godot-cpp\src\gdexample.h(4): fatal error C1083: Cannot open include file: 'Godot.hpp': No such file or directory scons: *** [src\gdexample.obj] Error 2 scons: building terminated because of errors.
As I compiled with scons, it throws me the error of No such file or directory. I've already generate its bindings including Godot.hpp
I'm using Visual Studio code with this and it can detect Godot.hpp and throws no errors but it throws errors on cmd scons command
I'm I missing something?
In this current section, my new SConstruct file was been combined with the old.
In your SConstruct file, look at the lines with env.Append(CPPPATH.
These lines add directories for the compiler to look for header files. Among others, you should be able to find a path to the directory containing Godot.hpp.
Make sure it has the correct paths.
For example, mine:
env.Append(CPPPATH = [
'.',
'godot-cpp/godot_headers/',
'godot-cpp/include/',
'godot-cpp/include/core/',
'godot-cpp/include/gen/'
])
And my directory structure:
Note: my SConstruct is separate from the godot-cpp one.
Is this still an issue? Typically this is due to your SConstruct file specifying the wrong path to the C++ bindings.
Same thing, check your include paths. Recently godot-headers was renamed with a - instead of an _ so make sure your paths are correct. (see also https://github.com/godotengine/godot-cpp/issues/523)
I'm not seeing a file called Godot.hpp within my folders. There is one named godot.hpp, however. Could this difference in capitalization be part of the reason why I'm getting a similar error?
The answers I gave were for GDNative in Godot 3. This might not apply 1:1 to the master branch which is now GDExtension for Godot 4. But in general if your compiler cannot find a header it is also because of a similar problem: header paths in your build script need a fix to contain the right directories (as when using any C++ library generally)
i dont have any godot.hpp or Godot.hpp file