使用QtCreator和qt5安装Qt3D时出错

Error installing Qt3D with QtCreator and qt5

本文关键字:Qt3D 出错 安装 qt5 QtCreator 使用      更新时间:2023-10-16

我尝试在Windows 8上使用QtCreator 5.1.1安装Qt3D,但我不知道如何成功。

首先,我遵循了文档中给出的步骤:

  • 获取git://gitorious.org/qt/qt3d
  • 打开QtCreator中的.pr
  • 将"install"answers"-j3"参数添加到make命令中

当我构建项目时,我会得到以下错误:

In file included from D:qt3Dprojectqt-qt3dsrcthreedglobalqglnamespace.cpp:42:0:
D:qt3Dprojectqt-qt3dsrcthreedglobalqglnamespace.h:45:29: fatal error: Qt3D/qt3dglobal.h: No such file or directory
#include <Qt3D/qt3dglobal.h>
^
compilation terminated.
Makefile.Debug:2547: recipe for target '.obj/debug_shared/qglnamespace.o' failed
mingw32-make[3]: *** [.obj/debug_shared/qglnamespace.o] Error 1
mingw32-make[3]: Leaving directory 'D:/qt3D/project/release/src/threed'
Makefile:38: recipe for target 'debug-all' failed
mingw32-make[2]: Leaving directory 'D:/qt3D/project/release/src/threed'
Makefile:40: recipe for target 'sub-threed-make_first-ordered' failed
mingw32-make[1]: Leaving directory 'D:/qt3D/project/release/src'
makefile:43: recipe for target 'sub-src-make_first' failed
mingw32-make[2]: *** [debug-all] Error 2
mingw32-make[1]: *** [sub-threed-make_first-ordered] Error 2
mingw32-make: *** [sub-src-make_first] Error 2
15:07:03: Le processus "C:QtQt5.1.1Toolsmingw48_32binmingw32-make.exe" s'est terminé avec le code 2.
Erreur lors de la compilation/déploiement du projet qt3d (kit : Desktop Qt 5.1.1 MinGW 32bit)
Lors de l'exécution de l'étape "Make"

因此,我在文件夹"C:\Qt\Qt5.1.1\5.1.1 \mingw48_32\include"中创建了以下文件夹:

  • Qt3D:我在那里复制了所有位于Qt3D源的src/threed文件夹的子文件夹中的.h文件
  • Qt3DQuick:我把所有的.h文件都复制到了qt3d源的src/quick3d文件夹中

我重新运行编译,然后我得到了以下错误:

D:qt3Dprojectqt-qt3dsrcquick3dqquickeffect.cpp:44:24: fatal error: qglpainter.h: No such file or directory
#include "qglpainter.h"
^
compilation terminated.
Makefile.Release:810: recipe for target '.obj/release_shared/qquickeffect.o' failed
mingw32-make[3]: *** [.obj/release_shared/qquickeffect.o] Error 1
mingw32-make[3]: *** Waiting for unfinished jobs....
D:qt3Dprojectqt-qt3dsrcquick3dqquickitem3d.cpp:47:32: fatal error: qgllightparameters.h: No such file or directory
#include "qgllightparameters.h"
^
compilation terminated.
D:qt3Dprojectqt-qt3dsrcquick3dqquickmesh.cpp:44:30: fatal error: qglabstractscene.h: No such file or directory
#include "qglabstractscene.h"
^
compilation terminated.
Makefile.Release:949: recipe for target '.obj/release_shared/qquickitem3d.o' failed
mingw32-make[3]: *** [.obj/release_shared/qquickitem3d.o] Error 1
Makefile.Release:1053: recipe for target '.obj/release_shared/qquickmesh.o' failed
mingw32-make[3]: *** [.obj/release_shared/qquickmesh.o] Error 1
mingw32-make[3]: Leaving directory 'D:/qt3D/project/release/src/quick3d'
mingw32-make[2]: *** [release-install] Error 2
Makefile:58: recipe for target 'release-install' failed
mingw32-make[2]: Leaving directory 'D:/qt3D/project/release/src/quick3d'
Makefile:107: recipe for target 'sub-quick3d-install_subtargets-ordered' failed
mingw32-make[1]: Leaving directory 'D:/qt3D/project/release/src'
mingw32-make[1]: *** [sub-quick3d-install_subtargets-ordered] Error 2
makefile:55: recipe for target 'sub-src-install_subtargets' failed
mingw32-make: *** [sub-src-install_subtargets] Error 2
15:18:09: Le processus "C:QtQt5.1.1Toolsmingw48_32binmingw32-make.exe" s'est terminé avec le code 2.
Erreur lors de la compilation/déploiement du projet qt3d (kit : Desktop Qt 5.1.1 MinGW 32bit)
Lors de l'exécution de l'étape "Make"

所以,我试图将所有需要的.h文件复制到需要的源文件夹中,但我没有成功。此外,我认为必须有另一种方法来获得我想要的东西,但我不知道该怎么做。

如果有人能帮我,我会很高兴的。

我找到了一种成功的方法:

  • 首先我下载了Qt的最新版本,Qt 5.2.1
  • 我从"git://gitorious.org/qt/qt3d将git客户端放入文件夹"C:\qt3d">
  • 带有终端"桌面版Qt 5.2.1(MinGW 4.8 32位)">

    cd C:qt3D
    qmake
    mingw32-make.exe install
    

"安装"非常重要,这样所有文件都可以复制到Qt配置文件夹中。

然后,在.pro文件中,添加

QT += 3d

在main.qml文件中:

import QtQuick 2.0
import Qt3D 2.0
import Qt3D.Shapes 2.0

Lauriane