简体   繁体   English

qt creator : 没有这样的文件或目录

[英]qt creator : no such a file or directory

hi i'm just trying to compile an easy project in qt嗨,我只是想在 qt 中编译一个简单的项目

#include <QApplication>

#include <QPushButton>

int main(int argc, char *argv[])
{
  QApplication app(argc, argv);

QPushButton bouton("Salut les Zéros, la forme ?");
bouton.show();

return app.exec();
}

but i have this error : /home/eid/test/easyprojet/main.cpp:1: error: QApplication: No such file or directory但我有这个错误:/home/eid/test/easyprojet/main.cpp:1: error: QApplication: No such file or directory

can anyone help me ?谁能帮我 ?

sorry for my english对不起我的英语

In Qt5, it resides in , while in Qt4 it was .在 Qt5 中,它驻留在 .

In Qt5 you need to add QT += widgets to your .pro file.在 Qt5 中,您需要将QT += widgets添加到您的 .pro 文件中。

It may be also because the project is not in the workspace of QT creator.也可能是因为该项目不在QT creator 的工作区中。 It happened with me before.它发生在我身上。 so,try to put the project in the workspace .因此,尝试将项目放在工作区中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM