3

我刚刚在 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 行中。

4

2 回答 2

4

原因是在 Ubuntu 20.04 上安装了新版本的 Qtcreator clang-10,但它仍然需要clang-8.

安装 clang-8 包:

apt install clang-8
于 2021-04-02T18:35:45.527 回答
0

如果错误是一个开放的红色圆圈,代码仍然会构建。

如果您想摆脱打开的红色圆圈,请进入帮助->关于插件并取消选中 Clang 代码模型插件。然后重启QT creator。

于 2021-04-30T20:45:58.207 回答