我刚刚在 Linux Ubuntu 20.04 LTS 中安装了 QTCreator,单击“文件”->“新建项目”->“应用程序”->“QTConsole 应用程序”。制作了first.pro 文件和main.cpp 文件。
第一个.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
Run Code Online (Sandbox Code Playgroud)
main.cpp 包含:
#include <QCoreApplication>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
return a.exec();
}
Run Code Online (Sandbox Code Playgroud)
错误出现在 QCoreApplication 行中。