gpt4 book ai didi

c++ - 不能包含为

转载 作者:行者123 更新时间:2023-11-28 05:12:17 26 4
gpt4 key购买 nike

在我的项目中,QtCreator 让我可以:

#include <QtCore> // include all core
#include <QString>

但不是

#include <QtCore/QString>

我有一个 .pro 文件,其中有 QT += core ... 所以我不知道是什么问题。我查看了编译输出,它附加了 -I/path/to/qt/include/QtCore/ 但我希望它也添加 -I/path/to/qt/include/。我不知道是什么问题。我在 Ubuntu 14.04 上使用了这个项目,现在升级到 16.04。现在我遇到了这个问题。我的 QTDIR 已设置,我的 Qt 套件未显示异常等。

最佳答案

Qt 没有记录到include 的路径编译时目录在包含路径中。你不应该写 #include <QtCore/QString> .你应该写 #include <QString>就像文档说的那样:

http://doc.qt.io/qt-5/qstring.html

如果您真的非常需要,您可以在 .pro 中手动将此路径添加到您的包含路径中文件:

INCLUDEPATH += /path/to/qt/include

关于c++ - 不能包含为 <QtCore/QString>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43276777/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com