I am trying to build Qt3D as it seems to not ship by default with Qt6 anymore.
I just finished installation on ubuntu, without major issue (it would have helped if the install instruction could have mentioned that the vulkan sdk is required, which was not obvious, but after installing the SDK the compilation finished successfully). I used the Qt Creator to build the library.
I am trying to do the same on windows, I installed both perl and vulkan as per install instructions above. After opening the qt3d.pro project and attempting to build it in Release mode, I am getting stuck where vulkan is requires
C:\Qt\AdditionalLibraries\Qt\qt3d-6.0.1\Src\src\render\surfaces\vulkaninstance.cpp: In lambda function:
C:\Qt\AdditionalLibraries\Qt\qt3d-6.0.1\Src\src\render\surfaces\vulkaninstance.cpp:54:34: error: invalid use of incomplete type 'class QVulkanInstance'
QVulkanInstance* v = new QVulkanInstance;
^~~~~~~~~~~~~~~
In file included from C:\Qt\AdditionalLibraries\Qt\qt3d-6.0.1\Src\src\render\surfaces\vulkaninstance.cpp:40:
C:\Qt\AdditionalLibraries\Qt\qt3d-6.0.1\Src\src\render\surfaces\vulkaninstance_p.h:60:7: note: forward declaration of 'class QVulkanInstance'
class QVulkanInstance;
^~~~~~~~~~~~~~~
C:\Qt\AdditionalLibraries\Qt\qt3d-6.0.1\Src\src\render\surfaces\vulkaninstance.cpp:60:59: error: invalid use of incomplete type 'class QByteArray'
if (debug_mode || qgetenv("QT3D_VULKAN_VALIDATION").toInt())
^
In file included from C:/Qt/6.0.1/mingw81_64/include/QtGui/qtguiglobal.h:43,
from C:\Qt\AdditionalLibraries\Qt\qt3d-6.0.1\Src\src\render\surfaces\vulkaninstance_p.h:54,
from C:\Qt\AdditionalLibraries\Qt\qt3d-6.0.1\Src\src\render\surfaces\vulkaninstance.cpp:40:
C:/Qt/6.0.1/mingw81_64/include/QtCore/qglobal.h:1259:7: note: forward declaration of 'class QByteArray'
class QByteArray;
^~~~~~~~~~
C:\Qt\AdditionalLibraries\Qt\qt3d-6.0.1\Src\src\render\surfaces\vulkaninstance.cpp:61:14: error: invalid use of incomplete type 'class QVulkanInstance'
v->setLayers({ "VK_LAYER_KHRONOS_validation" });
^~
In file included from C:\Qt\AdditionalLibraries\Qt\qt3d-6.0.1\Src\src\render\surfaces\vulkaninstance.cpp:40:
C:\Qt\AdditionalLibraries\Qt\qt3d-6.0.1\Src\src\render\surfaces\vulkaninstance_p.h:60:7: note: forward declaration of 'class QVulkanInstance'
class QVulkanInstance;
^~~~~~~~~~~~~~~
C:\Qt\AdditionalLibraries\Qt\qt3d-6.0.1\Src\src\render\surfaces\vulkaninstance.cpp:63:15: error: invalid use of incomplete type 'class QVulkanInstance'
if (!v->create())
^~
In file included from C:\Qt\AdditionalLibraries\Qt\qt3d-6.0.1\Src\src\render\surfaces\vulkaninstance.cpp:40:
C:\Qt\AdditionalLibraries\Qt\qt3d-6.0.1\Src\src\render\surfaces\vulkaninstance_p.h:60:7: note: forward declaration of 'class QVulkanInstance'
class QVulkanInstance;
^~~~~~~~~~~~~~~
jom: C:\Qt\AdditionalLibraries\Qt\qt3d-6.0.1\build-qt3d-Desktop_Qt_6_0_1_MinGW_64_bit-Release\src\render\Makefile.Release [.obj\release\vulkaninstance.o] Error 1
the first error message error: invalid use of incomplete type 'class QVulkanInstance'
suggests to me that the library was not found. I checked my environmental variables, i.e. the System variables
. Two environmental variables were created by the vulkan SDK installer named VULKAN_SDK
and VK_SDK_PATH
as also described in the vulkan getting started guide, both pointing to the root of the installation folder, i.e. C:\Program Files\VulkanSDK\1.2.162.1
. I have checked my Path
variable, and the bin folder has also been added C:\Program Files\VulkanSDK\1.2.162.1\bin
. Even with these entries available, I still get the same error message as above. Adding both C:\Program Files\VulkanSDK\1.2.162.1\Include
and C:\Program Files\VulkanSDK\1.2.162.1\Lib
to the Path
doesn't change the result either. I should say here that I ran some of the vulkan examples which were running fine (i.e. vkcube.exe, for example).
I am building the library (or rather trying to) in Qt Creator (using Qt version 6.0.1) and I have checked before attempting to build that all of the above environmental variables are available during build (by checking that these entries exist in Projects->Build Environment->Use System Environment->Details
).
I have also tried adding an external library to the qt3d.pro file but I would assume that the build script should not be modified and that the error is rather with my build environment.
Any suggestions where the error might have creeped in?
I should have mentioned, I was using the default kit MinGW on windows ... switching to MSVC seems to have worked and I am able to build the library now, not sure though why mingw did not work. Maybe some permission issue? Anyways, this solution is acceptable to me, leaving this answer here in case someone stumbles upon this in the future.