Qt 5中的Qt3D QCircularBuffer在哪里?

3

我想尝试使用 QCircularBuffer,参考自https://doc.qt.io/archives/qt-5.5/qt3d-qcircularbuffer.html。因此,在macOS上使用QtCreator创建了一个简单的Qt(版本为5.15.1)项目,如下所示:

#include <QApplication>
#include <QWidget>

#include <Qt3D>

int main(int argc, char *argv[]) {
    QApplication a(argc, argv);
    QWidget w;
    w.show();
    return a.exec();
}

在项目文件中,我有以下内容

QT += core gui widgets 3dcore

但我无法构建这个,我遇到了以下问题:

18:48:09: Running steps for project project...
18:48:09: Configuration unchanged, skipping qmake step.
18:48:09: Starting: "/usr/bin/make" -j8
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -pipe -stdlib=libc++ -g -std=gnu++1z  -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -mmacosx-version-min=10.13 -Wall -Wextra -fPIC -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_3DCORE_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I. -I../../Qt5.15.1/5.15.1/clang_64/lib/QtWidgets.framework/Headers -I../../Qt5.15.1/5.15.1/clang_64/lib/Qt3DCore.framework/Headers -I../../Qt5.15.1/5.15.1/clang_64/lib/QtGui.framework/Headers -I../../Qt5.15.1/5.15.1/clang_64/lib/QtNetwork.framework/Headers -I../../Qt5.15.1/5.15.1/clang_64/lib/QtCore.framework/Headers -Idebug -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/AGL.framework/Headers -I../../Qt5.15.1/5.15.1/clang_64/mkspecs/macx-clang -F/Users/user/Qt5.15.1/5.15.1/clang_64/lib -o debug/main.o main.cpp
main.cpp:6:10: fatal error: 'Qt3D' file not found
#include <Qt3D>
         ^~~~~~
1 error generated.
make: *** [debug/main.o] Error 1
18:48:10: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project project (kit: Desktop Qt 5.15.1 clang 64bit)
The kit Desktop Qt 5.15.1 clang 64bit has configuration issues which might be the root cause for this problem.
When executing step "Make"

看起来我做错了什么,是吗?


你安装了3D模块吗? - scopchanov
我认为是这样的,因为如果我注释掉 #include <Qt3D>,项目可以使用 QT += core gui widgets 3dcore 正常构建。 - KcFnMi
这不是证明,我猜的。虽然我没有在Qt中安装此模块,但我也能使用QT += 3dcore编译项目。 - scopchanov
在我看来,这个类已经从Qt3D中被移除了。你有没有看过QContiguousCache?它看起来具有相同的功能。顺便说一下,我从来没有见过有人像你这样导入Qt3D。我总是直接导入我需要的类。 - Florian Blume
我应该导入什么来使用QCircularBuffer?假设我正在使用拥有QCircularBuffer版本的Qt。 - KcFnMi
1个回答

0
请在您项目的 .pro 文件中添加 QT += 3dcore。
如果错误仍然存在,则表示您的“Qt3D.Core”模块未安装,请安装后重新编译您的项目。

QT += 3dcore is already there, as mentioned in the question. There is no error related to incluing 3dcore. As I understand, it complains about that Qt3D, I'm afraid it doesn't exist anymore in Qt 5.15.1 - KcFnMi

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接