QMainWindow: No Such File Or Directory

20,257

Solution 1

Mybe there was some error while your building qt from source, or something is missing. Try search QMainWindow.h in qt include dir. Seems like it is in /usr/local/qt4.8.2-armhf/include. For am example you can search like this find * /usr/local/qt4.8.2-armhf/include/ | grep QMainWindow.

Solution 2

Using Qt 5.8.0 on Win 7 / MSVC2015x64bit;

I had the same issue and I found a way to fix it, even if its not the smartest:

1) Open your projectname.pro file

2) Between QT += core gui and greaterThan(QT_MAJOR_VERSION, X): QT += widgets paste QT += widgets so this part looks kinda like this:

... QT += core gui QT += widgets greaterThan(QT_MAJOR...

Save and close the .pro file and wait for Qt to automatic read the file-changes and updating itself.
(If you have deaktivated this try restart Qt)

Aswell as this - replacing the "X" at greaterThan(QT_MAJOR_VERSION, X): QT += widgets with the pre-version's number works fine for me. (X = your_major_version - 1)

(In case using Qt 5.x place a 4 instead of 5, using Qt 3.x replace 3 with 2 and so on...)

I dont know if this also works for other platforms...

I hope i could help at least 1 person who has the same issue. ;)

Greetings Zitro

Share:
20,257
Admin
Author by

Admin

Updated on March 26, 2020

Comments

  • Admin
    Admin about 4 years

    I'm using QT Creator 3.5.1 and QT 4.8.2 on Ubuntu 14.04 LTS host machine, I configured my BeagleBone Kit for ARM crosscompiling like this: QT for BeagleBone

    I'm following these steps, but I'm getting an error when trying to compile the default QT project QMainWindow Error

    Am I missing something? If it's not found, it is not located at place where compiler looks. How do you fix this?

    Here is my project file

    Picture of my project