Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
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
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
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
You can add
INCLUDEPATH += $$PWD/srcto your .pro file.
Great! It works, thank you very much~
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 :)