Use mingw32 to compile the mysql driver PROCESS IN QT

Source: Internet
Author: User

I have compiled the QT MySQL driver in http://download.csdn.net/source/2794174

 

The compilation process is as follows:

First install QT creator. the version I used is 2010.05 and has been integrated with mingw32.

1. Download and install MySQL SDK, http://www.mysql.com/downloads/connector/cpp/

2. Create the C:/MySQL/mysql51 directory under drive C, and copy the include and Lib directories under C:/program files/MySQL connector C 6.0.2.

3. Download a DEV-CPP and add C:/dev-CPP/bin to the path of the system environment variable.

4. Download the dynamic library format conversion tool http://www.qtcn.org/download/mingw-utils-0.3.tar.gz
Decompress reimp.exe to the dev-CPP/bin directory.

5. run cd c:/MySQL/mysql51/opt/In the CMD command line to enter the MySQL library directory and run reimp-D libmysql. lib converts it to libmysql. def, and then run dlltool-K-D libmysql. def-l libmysql. A

6. Click the "Start" button in the lower left corner of the screen to go to "qt sdk by Nokia v2010.05 (Open Source)", select "QT command promptworkflow", enter the command line with qt, and execute configure.exe
-Debug-and-release-platform win32-g ++-QT-SQL-mysql-l mysql-I
C:/MySQL/mysql51/include-l c:/MySQL/mysql51/lib/OPT, which is a long wait ...,

Then execute the mingw32-make sub-src, and then it's a longer wait...

7. after completion, enter C:/Qt/2010.05/qt/src/plugins/sqldrivers/mysql, and enter qmake-o Makefile "INCLUDEPATH + = C: /MYSQL/MYSQL51/INCLUDE "" LIBS + = C:/MYSQL/MYSQL51/LIB/OPT/LIBMYSQL. a "mysql. pro

8. Input mingw32-make

9. After compilation is complete, there will be more in C:/Qt/2010.05/qt/plugins/sqldrivers/

  • Libqsqlmysql4.a
  • Libqsqlmysqld4.a
  • Qsqlmysql4.dll
  • Qsqlmysqld4.dll

Compilation is successful. In addition, the C:/MySQL/MySQL51/lib/opt/libmysql. dll file must be copied under c:/qt/2010.05/qt/bin. Then you can write the qt program to connect to mysql, but there is also a problem at this time, that is, the compilation will report an error and mysql cannot be found. h. I used to copy all the files in c:/mysql/mysql51/include to C:/Qt/2010.05/qt/include/QtSql.

 

Reference: http://student.csdn.net/space.php? Uid = 32341 & do = blog & id = 10663

 

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.