0
点赞
收藏
分享

微信扫一扫

【QT】Create subdirs project with qt creator


本文例子是在《foundations of Qt Development》p462的 Building Complex Projects with QMake小节的基础上建立起来的,本次实验在Mac上进行的,前面的几张截图是在Win7上得来的,不必在意。

最终想要得到的目录结构:

【QT】Create subdirs project with qt creator_ico

step1 create root directory

【QT】Create subdirs project with qt creator_macosx_02

step 2 create app directory

【QT】Create subdirs project with qt creator_ico_03

step3 create src directory

【QT】Create subdirs project with qt creator_macosx_04

step 4 write content for src pro file

TARGET = base
VERSION = 0.1.0
CONFIG = static
DESTDIR = ../lib

INCLUDEPATH += ../include
DEPENDPATH += . ../include
SOURCES += base.cpp
HEADERS += base.h

The difference of DEPENDPATH and INCLUDEPATH: INCLUDEPATH is used to search header files, DEPENDPATH is important for recompile.
Relative discussion link: ​​​https://www.qtcentre.org/threads/17346-QMake-s-INCLUDEPATH-and-DEPENDPATH-problems​​

INCLUDEPATH is used during compilation to find included header files. DEPENDPATH is used to resolve dependencies between header and source files, eg. which source files need to be recompiled when certain header file changes. If you modify a header file in folder foo/ and foo/ is not listed in DEPENDPATH, nothing gets recompiled. If foo/ is listed in DEPENDPATH, source files depending on that header will get recompiled. Paths can be relative to the .pro file or absolute paths.

clang: error: invalid deployment target for -stdlib=libc++ (requires OS X 10.7 or later):

我们可以在pro file中人为设定deploy的version


QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.13
message( "This is a message about deploy target: " )
message( $$QMAKE_MACOSX_DEPLOYMENT_TARGET )

在MacOS升级到10.14后,QT build工程的时候一直有10.14SDK没有被QT测试的警告信息:

我们可以加上:​​CONFIG += sdk_no_version_check​​ 屏蔽这些烦人的警告。

查看build的东西:

【QT】Create subdirs project with qt creator_sed_05


运行程序:


【QT】Create subdirs project with qt creator_ico_06

工程上传于:​​https://github.com/theArcticOcean/qtLib/tree/master/complex​​

【QT】Create subdirs project with qt creator_QT_07


举报

相关推荐

0 条评论