Compile the MySQL driver of QT in Windows

Source: Internet
Author: User

Step 1: open a command prompt and run:

# C:/QT/2010.05/bin/qtenv. bat

Configure the environment variables. This is a temporary configuration. After CMD is disabled, it becomes invalid. Adding this step saves the trouble of environment variable configuration.

Step 2:

# Cd c:/QT/2010.05/QT/src/plugins/sqldrivers/MySQL

Switch to this directory and open the mysql. Pro file under this directory in a text editor.

Step 3:

Add the following to MySQL. Pro:

Export depath + = "C:/program files/MySQL Server 5.1/include"

Libs + = "C:/program files/MySQL Server 5.1/lib/opt/libmysql. lib"

Save and exit

 

Step 4:

# Qmake-O makefile mysql. Pro

Three warning messages are prompted, but the alarm is not affected.

Step 5:

# Mingw32-make

Compile the MySQL driver. It will soon be finished. It's easy enough.

Four files are added to C:/QT/2010.05/QT/plugins/sqldrivers:
Qsqlmysql4.dll
Libqsqlmysql4.a
Qsqlmysqld4.dll
Libqsqlmysqld4.a

Step 6: Find out how to use it.

Legend:

If not, copy C:/program files/MySQL Server 5.1/lib/opt/libmysql. DLL to the directory where the running program is located or system32.

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.