Я создал форму History.ui. Я также создал History.hpp и History.cpp. Я получаю ошибки в файле History.cpp.
history.hpp
Код: Выделить всё
#ifndef HISTORY_HPP
#define HISTORY_HPP
#include
namespace Ui {
class History;
}
class History : public QDialog
{
Q_OBJECT
public:
explicit History(QWidget *parent = nullptr);
~History();
private:
Ui::History *ui;
};
#endif // HISTORY_HPP
Код: Выделить всё
#ifndef MAINWINDOW_HPP
#define MAINWINDOW_HPP
#include
#include "history.hpp"
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();
private slots:
void on_pushButton_3_clicked();
private:
Ui::MainWindow *ui;
History *historyDialog;
};
#endif // MAINWINDOW_HPP
Код: Выделить всё
#include "history.hpp"
#include "ui_history.h"
History::History(QWidget *parent) :
QDialog(parent),
ui(new Ui::History)
{
ui->setupUi(this);
}
History::~History()
{
delete ui;
}

Я пробовал пересобираю проект, но ошибки по-прежнему возникают.
Я добавил все файлы в CMakeLists.txt. ChatGPT сообщает, что файл ui_history.h создается автоматически.
Ubuntu 24.04 LTS.
QT Creator 13.02.
Подробнее здесь: https://stackoverflow.com/questions/786 ... -a-project
Мобильная версия