Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to include file .h from other projects?
Hi everyone, I did 3 dialog projects, now I will create project main window, I wonder how to include file .h from other projects (copy it, create new one ...)?
poor_robert last edited by
Hmm, move header and source file to the directory where You created Your new project. Then include it in new file with #include directive. After that type (assuming that You are using Linux and You have Qt installed) in command line (be sure that Your working directory is new project directory):
If this won't help, write some more details: what do You use to write Your Qt applications (QtCreator, some other IDE). Then we will help You :)
I understand your idea, First, I think that I must copy file .h and .cpp from old projects to new project. But that way only resolves problem if we code form purely while having a dialog project I used qt designer. I must copy its file .ui to new project, doesn't it?
ps: I love Windows :)
Eddy last edited by
bq. I must copy its file .ui to new project, doesn’t it?
Yes, you should add it also in your pro file. eg. :
FORMS += yourdialog.ui