Good day to all! I installed Ubuntu 16.04 LTS on my brand new laptop and decided to install Qt here. I downloaded, so I installed the installation file for Qt version 5.7 c of.site, installed in the folder opt / qtsdk /. All is well. I launch QtCreator, create a standard (window) application, build it, everything starts and works.

Then, if you do everything through the terminal and the qmake utility, the project is not going to and qmake swears at the alleged lack of header files, but again, everything works through QtCreator.

Here is the output of the error that qmake produces: I do this:

qmake -project qmake make 

Writes:

 ...... In file included from main.cpp:1:0: mainwindow.h:4:23: fatal error: QMainWindow: Нет такого файла или каталога compilation terminated. ..... 

What could be the problem?

In the PATH environment variable, I wrote the path to qmake:

 sudo -s gedit /etc/profile PATH=/opt/qtsdk/5.7/gcc_64/bin:$PATH export PATH 

Here is the project structure:

 main.cpp #include "mainwindow.h" #include <QApplication> int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; w.show(); return a.exec(); } mainwindow.h #ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); private: Ui::MainWindow *ui; }; #endif // MAINWINDOW_H mainwindow.cpp #include "mainwindow.h" #include "ui_mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); } MainWindow::~MainWindow() { delete ui; } 

    1 answer 1

    "QMainWindow: There is no such file or directory" means that the file of the same name cannot be found in the search paths for the included files. It is solved by specifying the corresponding directory in the INCLUDEPATH pro-file, for example.

    By the way, why did you use the installer from the offsite, and not from the repository?

    • one
      Is this something as a / /opt/qtsdk/5.7/gcc_64/include/ / /opt/qtsdk/5.7/gcc_64/include/ / /opt/qtsdk/5.7/gcc_64/include/ / /opt/qtsdk/5.7/gcc_64/include/ / /opt/qtsdk/5.7/gcc_64/include/ ? Well, in the repository, the versions are updated slowly, not the fact that there is the latest Qt. - rekrut
    • @rekrut possible. I don't know where exactly this file is. - Vladimir Martyanov
    • By the way, please tell me the repository where you can download Qt. I'll try to put it that way. - rekrut
    • @rekrut yes everything seems like standard reps: packages.debian.org/search?keywords=qtbase5-dev - Vladimir Martyanov
    • one
      For me, it is more convenient from the repository. Maybe the version is not the newest, but it is updated independently. If you want the latest Qt, clone your git repository (link is on the official website), collect and use it for health. At the same time sometimes it is useful to look at source codes as this or that thing is implemented. - aleks.andr