Home > Database > Mysql Tutorial > qt4连接mysql_MySQL

qt4连接mysql_MySQL

WBOY
Release: 2016-06-01 13:36:33
Original
1358 people have browsed it

bitsCN.com

qt4连接mysql

 

运行平台:win7

 

编译器:vc

 

IDE:vs2010

 

MYSQL:5.5

 

怕自己忘了,也留作别人的参考

mysql所对应的dll和lib是qsqlmysqld4.dll和qsqlmysqld4.lib。这是由编译得来的。

 

1)首先进入cd %QTDIR%/src/plugins/sqldrivers/mysql目录,

 

2)运行命令qmake -o Makefile "INCLUDEPATH+=C:/MySQL/include" "LIBS+=C:/MySQL/lib/opt/libmysql.lib" mysql.pro,这里的C:/MySQL是mysql的安装目录,这里面不能有空格,如果有空格则无法编译通过,这时候,就必须把mysql安装目录下的include和lib复制到另外一个没有空格的目录中,比如我就复制到D:/work中,那么上面这条命令变成了

qmake -o Makefile "INCLUDEPATH+=D:/work/include" "LIBS+=D:/work/lib/libmysql.lib" mysql.pro

 

3)运行nmake,这时候在%QTDIR%/src/plugins/sqldrivers/mysql/debug下面就出现了所需的文件qsqlmysqld4.dll和qsqlmysqld4.lib

 

4)把这两个文件复制到%QTDIR%/plugins/sqldrivers下面
 

bitsCN.com
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template