QT .pro文件:如何更改MAC框架的默认包含路径 [英] QT .pro file: How to change default include path for MAC frameworks

查看:392
本文介绍了QT .pro文件:如何更改MAC框架的默认包含路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的.pro文件如下所示:

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
}

我想使用本地编译的框架,但是QT5.5自动包含来自QT5.5.0安装目录的框架...我看到一个带有以下包含开关的a.cpp编译:

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

我尝试在.pro文件中重设INCLUDEPATH =,希望它重设默认的包含路径并添加了正确的INCLUDEPATH += ./Qt/lib,但它不起作用.

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.

使用MAC,OS X 10.10.2

Using MAC, OS X 10.10.2

推荐答案

所使用的Qt安装将由您运行的qmake决定.如果您安装了多个版本的Qt(例如,一个是您自己从源代码构建的版本,另一个是系统或Qt Creator安装提供的版本),则需要确保您正在使用要使用的Qt运行qmake.您应该能够从命令行相当容易地验证这一点.如果您正在使用像Qt Creator之类的IDE并在选择正确的Qt时遇到问题,请首先尝试从命令行进行构建,以验证您可以通过这种方式获得正确的Qt作为第一步.如果从命令行完全控制使用哪个qmake的操作仍然无法正常工作,则这表明您尝试使用的qmake行为不符合预期.

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.

这篇关于QT .pro文件:如何更改MAC框架的默认包含路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆