我正在寫這個簡單的Qt應用程序,但它顯示以下錯誤。 任何人都可以解釋我爲什麼我得到這些錯誤?下面的代碼片段:Qt程序無法編譯
#include <QTextStream>
int main()
{
QTextStream out(stdout);
out << "console application\n";
}
遵循的步驟編譯:
qmake -project
qmake .pro file
make
按照上述步驟後,下面是我得到的輸出:
g++ -c -pipe -g -Wall -W -O2 -D_REENTRANT -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -DQT_SHARED -DQT_TABLET_SUPPORT -I/usr/share/qt3/mkspecs/default -I. -I. -I/usr/include/qt3 -o text.o text.cpp
text.cpp:1:23: error: QTextStream: No such file or directory
text.cpp: In function ‘int main()’:
text.cpp:5: error: ‘QTextStream’ was not declared in this scope
text.cpp:5: error: expected ‘;’ before ‘out’
text.cpp:6: error: ‘out’ was not declared in this scope
make: *** [text.o] Error 1
平臺:Linux
如果你想要Qt4(根據你的標籤),你爲什麼要指定Qt3頭文件路徑? – Mat