Reputation: 3184
I have a project in Qt Creator
which has several shared library projects and the main project which also contains the main function. What I want is to add a new project which shouldn't be a shared library but just a project with some header files where I keep definitions and error codes. What I wish is to be able to add the path of this project to other projects INCLUDEPATH
in order to use those files in other projects.
To do so I created an empty project which .pro
file looks like this:
HEADERS += \
myHeader.h
but when I build the whole project it complains that it doesn't find the main in this project with only one header.
Is it possible in QtCreator
to achieve this?
Upvotes: 0
Views: 138
Reputation: 22366
Create a .pri
file which has your INCLUDEPATH
, etc; and then refer to it in your other projects' .pro
files:
# Common.pri
INCLUDEPATH += ../myPath
INCLUDE += myHeader.h
# OtherProject.pro
!include( ./Common.pri ) {
error( Could not find the Common.pri file. )
}
INCLUDEPATH += ../myOtherPath
Remember to use the +=
operator in your .pro
files otherwise they will overwrite the .pri
file variables.
Upvotes: 2