问题
My .pro
file looks like this:
QT += core gui widgets
SOURCES += a.cpp
HEADERS += a.h
FORMS += a.ui
#Locally compiled Qt framework. Qt/out/{QtCore.framework,QtNetwork.framework..}
QMAKE_LFLAGS += -L./Qt/lib/
QMAKE_CXXFLAGS += -F./Qt/lib/
macx {
QMAKE_MAC_SDK = macosx10.9
LIBS += -framework QtCore -framework QtNetwork -framework QtGui -framework QtWidgets
}
I want to use frameworks compiled locally, but QT5.5 automatically includes framework from QT5.5.0 install directory ... I see a.cpp compiling with following include switch:
-I/Users/banana/Qt5.5.0/5.5/clang_64/lib/QtWidgets.framework/Headers
I tried resetting INCLUDEPATH =
in .pro
file in hopes that it resets the default include path and added proper INCLUDEPATH += ./Qt/lib
but it doesn't work.
Using MAC, OS X 10.10.2
回答1:
The Qt installation that gets used will be determined by which qmake
you run. If you have multiple versions of Qt installed (e.g. one you built from sources yourself and one provided by the system or by a Qt Creator install), you need to ensure you are running the qmake
from the Qt you want to use. You should be able to verify this from the command line fairly easily. If you are using an IDE like Qt Creator and are having issues getting the right Qt selected, try building from a command line first to verify that you can get the right Qt that way as a first step. If building things from the command line where you have absolute control over which qmake
is used still doesn't work, then this would suggest the qmake
you are trying to use isn't behaving in the expected way.
来源:https://stackoverflow.com/questions/33578619/qt-pro-file-how-to-change-default-include-path-for-mac-frameworks