fatal error: ui_mainwindow.h: No such file or directory #include "ui_mainwindow.h"
-
I've rebuild several times, run qmake etc. It doesnt solve .
#include "mainwindow.h" #include "ui_mainwindow.h" #include <QtWidgets/QMainWindow> #include <QMainWindow> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { ui->setupUi(this); // Initialize the new objects myThreadObject = new MyThread(); myQThread = new QThread(); // Move to new thread myThreadObject->moveToThread(myQThread); // connect signal and slots connect(this, &MainWindow::startWriting, myThreadObject, &MyThread::writeData); connect(myThreadObject, &MyThread::writingDone, this, &MainWindow::writingDoneByThread); // Start the new thread myQThread->start(); }
-
@suslucoder
Please don't delete an existing thread and then raise a new thread with the same question.What files do you have in your build/compile output directory? That is where it should be. Are you designing a
mainwindow.ui
from Qt Designer? -
@suslucoder said in fatal error: ui_mainwindow.h: No such file or directory #include "ui_mainwindow.h":
I'm trying to do that; reading datas from txt in a thread, and write datas to txt in another thread.
Sorry, but that has no relevance at all to a compilation problem.
[That's a completely separate matter from: given the questions you ask, if I were you I would not dream of doing anything involving threads...]
And is the missing file not in the
debug
directory? Assuming you're compiling for Debug, which you don't say. -
@suslucoder
And how did you achieve the solution, given that you've asked so much about this? -
@suslucoder
I'm sorry if you feel I'm being hard on you. Quite a few of your questions are things you really should be able to solve for yourself, not ask questions of other people. It may not seem like it, but in the long run reading documentation and solving things for yourself is the only way to learn. I will leave it at that now.BTW,
I copied "ui_mainwindow.h" file from another build file
This may or may not be right, depending on just what you did where. The
ui_mainwindow.h
has to be regenerated every time you edit in Designer to change themainwindow.ui
file. If you later find that you make changes in Designer and these are not reflected in your code, you will have hit a problem. Just saying.