TreeFrog Framework官方地址:http://www.treefrogframework.org/ 编译平台及软件:MacBook Air macos 10.11.6 Xcode Version 8.0 (8A218a) Qt5.6.1 mysql5.6.34 首先需要在环境变量中添加qmake路径 编译步骤: Step 1: cd $HOME/Downloads git clone git@github.com:treefrogframework/treefrog-framework.git cd TreeFrog Step 2: ./configure configure 有很多选项供选择: Configuration: -h, --help display this help and exit --enable-debug compile with debugging information(开启调试功能,文档推荐做法) --enable-gui-mod compile and link with QtGui module Installation directories: --prefix=PREFIX install files in PREFIX [/usr/local](安装目录,默认/usr/local,本人使用$HOME/Dev/TreeFrog) Fine tuning of the installation directories: --bindir=DIR user executables [/usr/local/bin] --libdir=DIR object code libraries [/usr/local/lib] --includedir=DIR C++ header files [/usr/local/include/treefrog] --datadir=DIR read-only architecture-independent data [/usr/local/share/treefrog] step 3: cd src make make install note:在make时会出现错误 TargetConditionals.h' file not found 解决办法:打开Qt/5.6/clang_64/mkspecs/qdevice.pri 文件加入如下行:!host_build:QMAKE_MAC_SDK = macosx10.xx 注意:macos10.xx 是基于Xcode版本填写,查看版本的可以打开如下路径: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.xx.sdk.(MacOSX10.xx.sdk就是路径) 将报错解决完之后再次make Step 4: cd ../tools make make install note:基本这里不会出现错误,出现错误纯属人品爆发 以上编译完成之后再--prefix所指定的目录下会出现如下:
编译完成之后的文件
按照官方文档http://www.treefrogframework.org/documents/tutorial这篇文章所示进行工程创建,我在使用MySql时总是会报错: DriverType: QMYSQL QSqlDatabase: QMYSQL driver not loaded QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7 Parameter 'DriverType' is invalid or RDB client library not available.