我编译mysql驱动的步骤是:
1安装mysql5,把其
安装目录下的include及lib文件夹考到G:/mysql目录下
2安装Qt Creator (qt-sdk-win-opensource-2010.05.exe) qt版本4.7
3设置QT的环境变量,目的是在命令行下能执行qmke及 mingw32-make两个命令。环境变量主要设置了以下两个
添加了新环境变量QTDIR=G:/Qt/qt //我的QT安装目录
给原有环境变量PATH添加了新路径:G:\Qt\mingw\bin //目的是在命令行下能执行mingw32-make
4 根据QT帮助文档编译mysql驱动,文档是这样描述的,见附:
我的步骤是按照文档来的,在命令行下执行以下命令
cd G:\Qt\qt\src\plugins\sqldrivers\mysql
qmake "INCLUDEPATH+=G:\mysql\include" "LIBS+=G:\mysql\lib\opt\libmysql.lib" mysql.pro
mingw32-make
编译进行几秒后,出现一大片类似以下的
错误:请问一下可能是什么错误,谢谢!
G:\software\Qt\qt\src\plugins\sqldrivers\mysql/../../../../include/QtCore/../../
src/corelib/tools/qvector.h:115: undefined reference to `_imp___ZN11QVectorData1
1shared_nullE' 附:How to Build the QMYSQL Plugin on
Windows You need to get the MySQL installation files. Run
SETUP.EXE and choose "Custom Install". Install the "Libs & Include Files" Module. Build the plugin as follows (here it is assumed that MySQL is installed in
C:\MySQL):<PRE cpp? brush:> cd %QTDIR%\src\plugins\sqldrivers\mysqlqmake "INCLUDEPATH+=C:\MySQL\include" "LIBS+=C:\MYSQL\MySQL Server <version>\lib\opt\libmysql.lib" mysql.pronmake
If you are
not using a Microsoft compiler, replace
nmake with
make in the line above.
Note: This database plugin is not supported for Windows CE.
Note: Including
"-o Makefile" as an argument to
qmake to tell it where to build the makefile can cause the plugin to be built in release mode only. If you are expecting a debug version to be built as well, don't use the
"-o Makefile" option.
按这里说的步骤就行http://www.qtcn.org/bbs/read-htm-tid-44229.html出现我这里所说的错误主要是可能我装了VS的原故,我把VS卸载了就能编译出来了