Godot-docs: Add information how to setup Godot in QT Creator 4.9

Created on 28 Mar 2019  路  8Comments  路  Source: godotengine/godot-docs

When I try to import Godot code to QT Creator 4.9, then I get a lot of errors:
Zrzut ekranu z 2019-03-28 08-32-03

IAlso this file with extension .cxxflags and cflags must be added to git ignore and they must be changed because by default they show that project is created in C++17

-std=c17
-std=c++17

Very helpful will be if default .config for #define will be provided for any platform because some part of code are not available to debug without it
This is my .config file, but I'm sure that this is mostly incomplete.

// Add predefined macros for your project here. For example:
// #define THE_ANSWER 42
#define TOOLS_ENABLED
#define X11_ENABLED
#define OPENGL_ENABLED
#define DEBUG_ENABLED
#define GDSCRIPT_ENABLED
enhancement

Most helpful comment

The correct directories to search for header files are specified in the SCons build files, but Qt Creator doesn't know how to use these. Qt Creator uses the .includes file to search for header files. When you import the project, Qt automatically adds all folders with header files into the .includes file. However, if multiple header files in different directories have the same filename, Qt Creator may, and often does, use the wrong one. So you need to ensure that the .includes file only includes the base directories you want Qt Creator to search. The code should specify the correct subdirectory.

Unfortunately, there is no standard approach; so it requires trial and error. At a minimum the current directory and the correct platform directory are needed. E.g. for linux:

.
platform/x11

The main SCons build file currently also includes the editor directory:


GDNative has its own include directory:

modules/gdnative/include

Finally, the third party libraries. The following directories should enable all the current third party libraries:

thirdparty/assimp
thirdparty/assimp/include
thirdparty/b2d_convexdecomp
thirdparty/bullet
thirdparty/cvtt
thirdparty/enet
thirdparty/etc2comp
thirdparty/freetype/include
thirdparty/glad
thirdparty/jpeg-compressor
thirdparty/libogg
thirdparty/libpng
thirdparty/libsimplewebm
thirdparty/libtheora
thirdparty/libvorbis
thirdparty/libvpx
thirdparty/libwebp
thirdparty/mbedtls/include
thirdparty/miniupnpc
thirdparty/minizip
thirdparty/misc
thirdparty/nanosvg
thirdparty/opus
thirdparty/pcre2
thirdparty/pvrtccompressor
thirdparty/recastnavigation/Recast/Include
thirdparty/squish
thirdparty/tinyexr
thirdparty/vhacd/inc
thirdparty/wslay/includes
thirdparty/xatlas
thirdparty/zlib
thirdparty/zstd

All 8 comments

Especially it would be nice to avoid the errors that come from class names colliding with the std:: namespace e.g. Vector and String

Info about that, anyone can find, when compiling Godot with this option

scons verbose=yes

everything which started from -D(-DSVG_ENABLED) should be put to .config file and everything what starts from -I(-Ithirdparty/libpng) to .includes file.

My config(Linux)
config file

#define DEBUG_ENABLED
#define DEBUG_MEMORY_ENABLED
#define DEBUG_MEMORY_ALLOC
#define DISABLE_FORCED_INLINE
#define TOUCH_ENABLED
#define ALSA_ENABLED
#define ALSAMIDI_ENABLED
#define PULSEAUDIO_ENABLED
#define _REENTRANT
#define JOYDEV_ENABLED
#define X11_ENABLED
#define UNIX_ENABLED
#define OPENGL_ENABLED
#define GLES_ENABLED
#define PTRCALL_ENABLED
#define TOOLS_ENABLED
#define GDSCRIPT_ENABLED
#define MINIZIP_ENABLED
#define ZSTD_STATIC_LINKING_ONLY
#define GLAD_ENABLED
#define GLES_OVER_GL
#define FREETYPE_ENABLED
#define SVG_ENABLED
#define HAVE_MNTENT

my .includes file

thirdparty/nanosvg
thirdparty/freetype/include
thirdparty/libpng
thirdparty/glad
thirdparty/zstd
thirdparty/zlib
platform/x11
.
editor platform/x11/power_x11.cpp

The correct directories to search for header files are specified in the SCons build files, but Qt Creator doesn't know how to use these. Qt Creator uses the .includes file to search for header files. When you import the project, Qt automatically adds all folders with header files into the .includes file. However, if multiple header files in different directories have the same filename, Qt Creator may, and often does, use the wrong one. So you need to ensure that the .includes file only includes the base directories you want Qt Creator to search. The code should specify the correct subdirectory.

Unfortunately, there is no standard approach; so it requires trial and error. At a minimum the current directory and the correct platform directory are needed. E.g. for linux:

.
platform/x11

The main SCons build file currently also includes the editor directory:


GDNative has its own include directory:

modules/gdnative/include

Finally, the third party libraries. The following directories should enable all the current third party libraries:

thirdparty/assimp
thirdparty/assimp/include
thirdparty/b2d_convexdecomp
thirdparty/bullet
thirdparty/cvtt
thirdparty/enet
thirdparty/etc2comp
thirdparty/freetype/include
thirdparty/glad
thirdparty/jpeg-compressor
thirdparty/libogg
thirdparty/libpng
thirdparty/libsimplewebm
thirdparty/libtheora
thirdparty/libvorbis
thirdparty/libvpx
thirdparty/libwebp
thirdparty/mbedtls/include
thirdparty/miniupnpc
thirdparty/minizip
thirdparty/misc
thirdparty/nanosvg
thirdparty/opus
thirdparty/pcre2
thirdparty/pvrtccompressor
thirdparty/recastnavigation/Recast/Include
thirdparty/squish
thirdparty/tinyexr
thirdparty/vhacd/inc
thirdparty/wslay/includes
thirdparty/xatlas
thirdparty/zlib
thirdparty/zstd

Thanks @madmiraal I can confirm your proposed setup work (though with a lot of NULL use warnings) with Qt Creator 4.10.0

They are valid warnings. See Wikipedia's explanation: Null pointer constant.

PR 32697 removes the requirement for editor being in the .includes file.

Is this considered resolved with the current Qt Creator setup page?

This remains an issue with Qt Creator. When importing a project, Qt Creator automatically creates .cflags, .cxxflags, .config and .includes files, but the documentation still doesn't explain how to update these appropriately.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jcmonkey picture jcmonkey  路  4Comments

tavurth picture tavurth  路  3Comments

jcs224 picture jcs224  路  3Comments

gvekan picture gvekan  路  3Comments

puthre picture puthre  路  4Comments