gpt4 book ai didi

c++ - Qt - qstring.h 包含字符串错误

转载 作者:太空宇宙 更新时间:2023-11-04 13:49:23 30 4
gpt4 key购买 nike

当涉及到 Qt 和在 Linux 上编译时,我是公认的菜鸟,如果这是一个简单的错误,请原谅我。

我正在尝试使用以下方法在 Ubuntu 14.04 LTS 上编译程序:qmake myprogram.pro && make

此应用程序使用 Qt4。我收到一个似乎源自 Qt 本身的奇怪错误。

In file included from /usr/include/qt4/QtCore/qobject.h:48:0,
from /usr/include/qt4/QtCore/qiodevice.h:46,
from /usr/include/qt4/QtCore/QIODevice:1,
from src/qt/fervor/quazip/zip.c:22:
/usr/include/qt4/QtCore/qstring.h:54:20: fatal error: string: No such file or directory
# include <string>
^

我猜这是一个环境问题,而不是我的程序的问题。我在网上浏览了一下,有些人建议不要安装 c++ build essentials。我已验证已安装 Ubuntu build-essentials 包。

提前致谢!

编辑

所以我进入了核心 qt 头文件 qstring.h,并找到了一个需要为我的环境定义的常量 (QT_NO_STL)。当我定义它时,我得到一个新错误:

In file included from /usr/include/qt4/QtCore/qlist.h:45:0,
from /usr/include/qt4/QtCore/qobject.h:50,
from /usr/include/qt4/QtCore/qiodevice.h:46,
from /usr/include/qt4/QtCore/QIODevice:1,
from src/qt/fervor/quazip/zip.c:14:
/usr/include/qt4/QtCore/qiterator.h:50:79: fatal error: new: No such file or directory
# include <new>

最佳答案

功劳确实属于@KubaOber,但为了帮助他人,我发布了解决我问题的答案。

事实证明我添加了一个依赖项(库)并且没有使用 qmake -project 重新创建 .pro 文件。

谢谢!

关于c++ - Qt - qstring.h 包含字符串错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24152532/

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