Under Window Qt compiled MySQL driver (actually used the dynamic library format conversion tool)

Source: Internet
Author: User

Step-by-step development of QT under Windows

Starting today to install MySQL, read some of the MySQL installation blog, the method is roughly the same, but the details of the problems encountered different, or not comprehensive, the following is a personal installation process and problems encountered.

1, first download, MySQL official website: http://www.mysql.com/downloads/installer/

2, installation, you will be prompted to install. NETFRAMEWORK4 environment, here is a download link: http://dldx.csdn.net/fd. PHP?I=537939463366842&S=17682A85274604196D6C02560D3E410C, the information is very good, thanks to the blogger's share ~

3, follow the prompts step by step installation, I started to choose is develop mode, http://blog.csdn.net/xw_hit/article/details/6127992 above, to choose Custom, later changed back to Custom mode, Here is not to say that the develop mode, which reason did not understand, and did not try, here or first choose Custom mode

4. Set the environment variables after the installation is complete.

My Computer-Properties-advanced-environment variables-System Variables-path add: C:\Program files\mysql\mysql Server 5.5\bin

5, compile QT under MySQL driver, also need to download a dynamic library format conversion tool, the URL is: http://www.qtcn.org/download/ Mingw-utils-0.3.tar.gz, unzip the inside Bin directory in the Remip.exe copy to MinGW Bin directory can be used

    1. CD C:\Program files\mysql\mysql Server 5.5\lib//There are libmysql.dll and other files, some in the opt file, according to personal circumstances
    2. Reimp-d Libmysql.lib
    3. Dlltool-k-D libmysql.def-l LIBMYSQL.A

This compiles into a LIBMYSQL.A file, the following to compile the MySQL plugin under QT

    1. CD%qtdir%/src/plugins/sqldrivers/mysql
    2. Qmake-o Makefile "Includepath+=c:/include" "LIBS+=C:/LIB/LIBMYSQL.A" Mysql.pro//Here The path can not have spaces, in order to solve this problem, the individual is to put C \ Program Files\mysql\mysql Server 5.5\ the lib and include files are copied to the C: root directory, so that the compilation is not a problem
    3. Mingw32-make//Generate libqsqlmysqld4.a and Qsqlmysqld4.dll two files

Copy the generated libqsqlmysqld4.a and Qsqlmysqld4.dll to qtdir/plugins/sqldrivers/. Personal in this place churn for a long, finally saw a blog post http://blog.csdn.net/xw_hit/article/details/6127992 Last, let me enlightened, Suddenly, O (∩_∩) o haha ~, The author describes this (I just modified the path):

Although the build succeeds, but still prompts Qsqldatabase:qmysql driver not loaded error, we need to copy the LibmySQL.dll file under the C:/mysql/lib directory to our Qt Creator in the Qt/bin directory under the installation directory .

http://blog.csdn.net/styyzxjq2009/article/details/8131917

Under Window Qt compiled MySQL driver (actually used the dynamic library format conversion tool)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.