【发布时间】:2021-01-18 17:29:56
【问题描述】:
我刚刚在 Linux Ubuntu 20.04 LTS 中安装了 QTCreator,我点击了 File->New Project->Application->QTConsole Application。制作了 first.pro 文件和 main.cpp 文件。
first.pro 包含:
QT -= gui declarative
QT += widgets
CONFIG += c++11 console
CONFIG -= app_bundle
DEFINES += QT_DEPRECATED_WARNINGS
SOURCES += \
main.cpp
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
main.cpp 包含:
#include <QCoreApplication>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
return a.exec();
}
错误出现在 QCoreApplication 行中。
【问题讨论】:
-
hangon - 你安装了
qtcreatorIDE?或整个 Qt 包 - 例如:qt.io/offline-installers ? -
意味着添加单击“Qt 5.x.x 离线安装程序链接”,然后选择 linux 主机。这会下载一个运行文件(你可以在命令行上运行)——它应该安装所有的库和你需要的一切(除了 gcc)。如果您只是安装 QtCreator,那么您可能缺少实际的 Qt 库......
标签: c++ user-interface qt5 qapplication qcoreapplication