Include additional directories in Qt
Where in Qt can I specify additional directories I want to be included to build开发者_运维知识库 my project?
By editing the corresponding .pro
file accordingly.
One of the possible variables is INCLUDEPATH
, and you can simply append via +=
as e.g.
INCLUDEPATH += /usr/include/foo \
/usr/local/include/bar \
/opt/include/bing
If you are using the Qt Creator IDE then I believe you must edit the .pro file directly. See the following link for details:
http://doc.qt.io/qt-5/qmake-project-files.html
If you are using a different IDE, such as Visual Studio using the add-in, you can edit the include path as you would for non-Qt projects.
You can do as you've already been told, adding paths to the INCLUDEPATH (see http://doc.qt.io/qt-5/qmake-common-projects.html) or, if you prefer, you can open your .pro file, and on the right where the content appears you can open the contextual menu. There you should see the item "Add Library...". A dialog appears where you can select which library to link to and which include paths to add to the .pro file. This is quite cross-platform and complete.
I've never used it, only saw it is there, maybe since version 2.1 or around that.
EDIT: I suggest anyway you learn how to write .pro files because you can do really interesting things.
精彩评论