Qmake cannot find source or header files

I am trying to transfer my project from one computer on qt4 to another, where I just installed qt5 , and I had a very strange problem.

qmake suddenly cannot find any of my source or header files.

Here is a minimalist example:

 QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = untitled TEMPLATE = app SOURCES += main.cpp\ mainwindow.cpp INCLUDEPATH += $$PWD/Dir/ DEPENDPATH += $$PWD/Dir/ HEADERS += mainwindow.h \ fh \ FORMS += mainwindow.ui 

Where Dir/fh exists in the same directory as untitled.pro . And I get this output from qmake:

 05:18:45: Starting: "/opt/QtSDK/5.0.2/gcc/bin/qmake" /home/martin/Projects/untitled/untitled.pro -r -spec linux-g++ CONFIG+=debug CONFIG+=declarative_debug CONFIG+=qml_debug WARNING: Failure to find: fh 05:18:45: The process "/opt/QtSDK/5.0.2/gcc/bin/qmake" exited normally. 

I absolutely do not know what causes this. What could be the problem?

EDIT:

When I manually add the name like this:

 HEADERS += Dir/fh \ 

qmake does not complain.

+4
source share
2 answers

Same issue resolved when I include VPATH in pro file

For example: VPATH + = .. / .. / libraries / INCLUDE + = .. / .. / libraries /

Also with qt 5 we do not need to include DEPENDPATH in pro files

+6
source

You have never defined PWD. The double dollar prefix $$ indicates the qmake variable defined earlier in the pro file. In your case, the $$PWD part is completely unnecessary. If you completely remove it, everything should compile simply.

Edit: In addition, they calmly changed the behavior of DEPENDPATH in Qt 5 . Starting with Qt 5, qmake now uses your INCLUDEPATH by default when searching for SOURCES and HEADERS ( config += depend_includepath ). Just omit the DEPENDPATH line and you should be good.

 INCLUDEPATH += "Dir" 

Link: Qmake variables in .pro files

+3
source

Source: https://habr.com/ru/post/1487557/


All Articles