@import url(http://www.cppblog.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);
@import url(http://www.cppblog.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);
装个插件装一天的人你伤不起啊!
其实说起来过程也简单…但是因为文档和实际情况有出入,折腾了这么久…
下面是step by step:
1.下载Qt的源代码,假设放在$QtDir里.并且确保电脑上已经装上mySQL了,如果你和我一样用安装包安装的话,mySQL应该是装在/usr/local/mysql的.要搞清楚这些文件的存放位置,下面要用到
2.在终端上定位到$QtDir/src/plugins/sqldrivers/mysql/下,输入(根据mySQL的安装位置不同,下面的include和libs的路径可能需要修改):
1 |
qmake "INCLUDEPATH+=/usr/local/mysql/include" "LIBS+=-L/usr/local/mysql/lib -lmysqlclient_r" mysql.pro -spec macx-g++ CONFIG+=build_all |
编译时可能会有类似这样的warning:
1 |
ld: warning: directory '/tmp/qt-stuff-6474/source/qt-everywhere-opensource-src-4.7.0/lib' following -L not found |
2 |
ld: warning: directory '/tmp/qt-stuff-6474/source/qt-everywhere-opensource-src-4.7.0/lib' following -F not found |
但这确实只是个warning而已
3.定位到/Developer/Applications/Qt/plugins/sqldrivers,这个也是用安装包安装时Qt的SQL driver默认位置(按情况修改),输入:
1 |
rm libqsqlmysql_debug.dylib |
2 |
install_name_tool -change libmysqlclient.16.dylib /usr/ local /mysql/lib/libmysqlclient.16.dylib libqsqlmysql.dylib |
上面mySQL client的版本也要按需更改,需要的版本这样查看:
1 |
otool -L libqsqlmysql.dylib |
完毕.
主要的经验有,以后在mac下用qmake要加参数-spec macx-g++,明确了各种include和libs的位置在哪里,以及…mac用户真是伤不起啊!windows有各种详细的step by step,linux用户估计直接apt-get神马的就可以…
好了,现在mac用户也有了…
From:http://canx.me/2011/04/mac-os-x下qt的mysql-driver编译安装/