How to modify .pro after changing the path of .h and .cpp files
-
Hi, I have a problem about .pro file.
In order to manage the source files, I moved all the .h & .cpp files under project directory to ./src/ and the .pro changes automatically as follows. But when I tried to rebuild, it reminds that " 'renderingwidget.h' not found in ui_mainwindow.h". Could you help me figure out the cause?SOURCES += \ src/main.cpp \ src/mainwindow.cpp \ src/renderingwidget.cpp HEADERS += \ src/mainwindow.h \ src/renderingwidget.h
-
@Geng.Y
did you rerun qmake after the changes? -
@raven-worx yes I tried.
you mean run qmake and then build the project?
It doesn't work -
-
@Geng.Y said in How to modify .pro after changing the path of .h and .cpp files:
you‘ll have to change your includes inside the cpp and h files also,
#include „renderingwidget.h“ to #include „src/renderingwidget.h“ or add the folders inside the pro file via the includepath makro
this is necessary for all files that include files that are not in the folder
-
Hi,
You can add
INCLUDEPATH += $$PWD/src
to your .pro file. -
You're welcome !
Since you have it working now, please mark the thread as solved using the "Topic Tools" button so that other form users may know a solution has been found :)