' qmainwindow'找不到文件

发布于 2025-01-31 01:59:10 字数 745 浏览 3 评论 0原文

该程序有效,但我不喜欢

MainWindow.h:

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow> //'QMainWindow' file not found

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private:
    Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H

因此,错误也出现在Main.cpp

:CPP:

#include "mainwindow.h" //In included file: 'QMainWindow' file not found

#include <QApplication>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;
    w.show();
    return a.exec();
}

该程序仍然有效,但我仍然想知道问题的解决方案

the program works, but I don't like these errors

in mainwindow.h:

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow> //'QMainWindow' file not found

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private:
    Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H

because of this, errors also appear in the main file

main.cpp:

#include "mainwindow.h" //In included file: 'QMainWindow' file not found

#include <QApplication>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;
    w.show();
    return a.exec();
}

the program still works, but I would still like to know the solution to the problem

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

拥抱我好吗 2025-02-07 01:59:10

那找到答案: https://stackoverflow.com/a/a/58737644/18282426

我已经在 代码> help - &gt; <代码>关于模块... 和禁用clangcodemodel

I have already found answer there: https://stackoverflow.com/a/58737644/18282426

so, select from above help -> About modules... and disable ClangCodeModel

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文