簡體   English   中英

Qt-qstring.h包含字符串錯誤

[英]Qt - qstring.h include string error

對於Qt和在Linux上進行編譯,我是一個公認的菜鳥,所以如果這是一個簡單的錯誤,請原諒我。

我正在嘗試使用以下qmake myprogram.pro && make在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 ++構建要點。 我已驗證已安裝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文件。

謝謝!

就我而言,它可以通過在<project> .pro文件中添加以下內容來實現:

配置+ = qt

或改為添加:

配置+ = qt

QT + = svg

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM