Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/147.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/qt/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ Qt-qstring.h包含字符串错误_C++_Qt_Ubuntu_Compiler Errors - Fatal编程技术网

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

C++ Qt-qstring.h包含字符串错误,c++,qt,ubuntu,compiler-errors,C++,Qt,Ubuntu,Compiler Errors,说到Qt和在linux上编译,我是公认的noob,所以如果这是一个简单的错误,请原谅我 我试图在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:

说到Qt和在linux上编译,我是公认的noob,所以如果这是一个简单的错误,请原谅我

我试图在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>
                   ^
在/usr/include/qt4/QtCore/qobject.h:48:0中包含的文件中,
from/usr/include/qt4/QtCore/qiodevice.h:46,
from/usr/include/qt4/QtCore/QIODevice:1,
来自src/qt/fervor/quazip/zip.c:22:
/usr/include/qt4/QtCore/qstring.h:54:20:致命错误:string:没有这样的文件或目录
#包括
^
我猜这是一个环境问题,而不是我的程序的问题。我已经在网上浏览了一些人,并建议没有安装C++的构建概要。我已经验证了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>
在/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,
来自src/qt/fervor/quazip/zip.c:14:
/usr/include/qt4/QtCore/qiterator.h:50:79:致命错误:新建:没有这样的文件或目录
#包括

这项荣誉确实属于@KubaOber,但为了帮助他人,我发布了解决我问题的答案

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


谢谢

在我的例子中,只需在.pro文件中添加以下内容即可:

CONFIG+=qt

或改为添加:

CONFIG+=qt


QT+=svg

所以我编辑了核心QT头文件(qstring.h),并将“string”替换为“string.h”,它就可以工作了。这似乎是通过定义常量QT\u NO\u STL来完成的。如何定义编译常量?好的。了解了如何定义QT\u NO\u\stl您的QT安装似乎已中断。当编译器在makefile中被调用时,这种预处理器定义应该作为命令行参数提供给编译器。Qmake应该透明地处理它。您可能正在混合Qt版本@库巴伯,你是对的。我需要一个新的qmake-project命令的结果。我合并了一些更改,我发现了一个新错误:-)如果您想将您的评论作为答案,我会将其标记为正确。谢谢