How do I add an entire directory to a QT creator p

2019-04-23 18:02发布

I have an existing QT Creator project. I want to add an entire directory to this project. I see that I can right click in the project file browser tree and "Add Existing Files..." However through this dialog box, I can only add individual files. How can I include an entire directory?

标签: qt qt-creator
2条回答
\"骚年 ilove
2楼-- · 2019-04-23 18:48

Open a terminal, navigate to the folder where you want to have you project file, and then run the command

qmake -project

This will search the current directory and all subdirectories for files with extensions such as .c, .cpp, .h, etc. (the full list is found by typing man qmake).

But keep in mind that it will overwrite your current .pro file if you already have a project set up.

查看更多
祖国的老花朵
3楼-- · 2019-04-23 18:57

The simplest way is to directly edit your .pro file, add HEADERS += mydir/*.h and SOURCES += mydir/*.cpp and the contents of the whole directory will show up in QT Creator. Further reference: http://qt-project.org/doc/qt-5/qmake-project-files.html

查看更多
登录 后发表回答