If you are using qmake, the standard Qt build system, just add a line to the .pro file as documented in the qmake Variable Reference:
INCLUDEPATH += <your path>
If you are using your own build system, you create a project by selecting "Import of Makefile-based project". This will create some files in your project directory including a file named <your project name>.includes. In that file, simply list the paths you want to include, one per line. Really all this does is tell Qt Creator where to look for files to index for auto completion. Your own build system will have to handle the include paths in its own way.
As explained in the Qt Creator Manual, <your path> must be an absolute path, but you can avoid OS-, host- or user-specific entries in your .pro file by using $$PWD which refers to the folder that contains your .pro file, e.g.
INCLUDEPATH += $$PWD/code/include

本文介绍了如何在QtCreator中为qmake项目及自定义构建系统的项目设置包含路径。对于使用qmake的项目,可以通过在.pro文件中添加一行来指定包含路径;而对于自定义构建系统的项目,则需要通过创建包含文件来指定路径。
1万+

被折叠的 条评论
为什么被折叠?



