Qt for WINDOWS:QT 5.5 MinGW statically compiled version made with MySQL

Source: Internet
Author: User
Tags win32 python mysql

See online A lot of people are seeking qt static compilation with MySQL, including myself, but also Google has more than n data to fix, is the so-called drop of Grace when the spring, no online friends of the post I still mengmengdongdong, so here I would like to tidy up, hope to help you


Use environment:WIN10PRO when configured with Kill soft, including win Defender

Process planning:

    1. Download the installation must be component qt5.5 perl python mysql etc.

    2. installing the QT 5 component Mysql Library Conversion

    3. Compiling the installation

    4. Configuration

    5. Use


    • Installation

    1. QT5 installation package here MinGW version:

:Http://download.qt.io/official_releases/qt/5.5/5.5.1/qt-opensource-windows-x86-mingw492-5.5.1.exe

The installation process is very simple, one thing is to install the source tick on the right. 650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/7F/29/wKioL1cVr8mAun1eAAA-zSYUCxk548.png "title=" Qinstall.png "alt=" Wkiol1cvr8maun1eaaa-zsyucxk548.png "/>

    • compiler configuration :

Open c:\qt\qt5.5.0\5.5\mingw492_32\mkspecs\win32-g++ folder Edit qmake.conf

Find Qmake_lflags and Qmake_lflags_dll and then change back to-static so that the files generated after the static compilation do not need to rely on the library dynamically.

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/7F/2A/wKioL1cVu_rDnM2iAAArozj-Xc0935.png "title=" Qtconf.png "alt=" Wkiol1cvu_rdnm2iaaarozj-xc0935.png "/>


2. Then the installation of Perl and Python:

Address: Http://downloads.activestate.com/ActivePerl/releases/5.20.1.2000/ActivePerl-5.20.1.2000-MSWin32-x64-298557.msi

Https://www.python.org/ftp/python/3.4.4/python-3.4.4.msi

Add the Python environment variable (Path) C:\python27;perl Normal will automatically add, if not manually add environment variable

3. mysql installation: Note that MySQL installation does not have spaces or Chinese, because QT compiles problems

Here I choose to install to D:\Mysql Https://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.49-win32.msi

Last download two conversion tools Reimp and Dlltool https://yunpan.cn/cPgMhxUAI29Mm access password 3e31 download and put it in the D:\mysql\lib directory


    • Compile & Prepare:

Start with the MySQL library file conversion, because MinGW is the Linux format library, and MySQL is the Windows format Library.

To open the Qt 5.5 for desktop command line from the Start menu

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/7F/29/wKioL1cVtWfxrG8AAACxzaJ-9Nw254.png "style=" float: none; "title=" Qtcmd.png "alt=" Wkiol1cvtwfxrg8aaacxzaj-9nw254.png "/>

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/7F/29/wKioL1cVtWeQkIH9AAAoXORGpsA029.png "style=" float: none; "title=" Qtcmd2.png "alt=" Wkiol1cvtweqkih9aaaoxorgpsa029.png "/>

First switch to the MySQL directory:

reimp-d Libmysql.libdlltool-k-D libmysql.def-l LIBMYSQL.A

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/7F/2C/wKiom1cVtwGRQRIEAAApNKnZ4QI946.png "title=" Mysqllibconvert.png "alt=" Wkiom1cvtwgrqrieaaapnknz4qi946.png "/>

Then the conversion is done as above, and the required files are generated when the conversion is completed libmysql.def LIBMYSQL.A etc.


Switch to source directory

Then proceed Configure650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M02/7F/2A/wKioL1cVuTSy5TTrAAA2zI6wZVM984.png " Title= "Config.png" alt= "Wkiol1cvutsy5ttraaa2zi6wzvm984.png"/>

Configuration:

Configure.bat-confirm-license-opensource-platform win32-g++-mp-release-static-prefix "C:\Qt\5.5_static"- Qt-sql-mysql-l mysql-i D:\Mysql\include-L D:\Mysql\lib-qt-sql-sqlite-qt-zlib-qt-libpng-qt-libjpeg-opengl Desktop- Qt-freetype-no-qml-debug-no-angle-nomake tests-nomake Examples-skip Qtwebkit-skip qtwebengine

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/7F/2C/wKiom1cVu63hidV0AABCOzSFigM063.png "title=" Configfinshpng.png "alt=" Wkiom1cvu63hidv0aabcozsfigm063.png "/>

Compile:

Mingw32-make-s

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/7F/2A/wKioL1cVvRKimi-wAAAPfeN_a9M605.png "title=" Mingw32-make. PNG "alt=" Wkiol1cvvrkimi-waaapfen_a9m605.png "/>

Here is a single-threaded no prompt, no way to configure the computer can not be single-threaded and not output, as if this will be a lot faster, etc.

Installation:

Mingw32-make Install


    • To add a qt version :

Open Qt Creator, tools, options, components, and running QT Versions

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/7F/2C/wKiom1cVwmryKGvJAAA8e9e_Ae8861.png "title=" Qtadd.png "alt=" Wkiom1cvwmrykgvjaaa8e9e_ae8861.png "/>

To set up a build suite:

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/7F/2A/wKioL1cVwxqxg5prAADxvhSJtoc679.png "title=" Qtadd2.png "alt=" Wkiol1cvwxqxg5praadxvhsjtoc679.png "/>

    • Test

There's no problem. This time the compilation is complete you can test whether MySQL static compilation succeeded

Put Libmysql.dll in the project Build folder or in Windows System32 before running

. Pro file Add qt+=sql#include <QtCore/QCoreApplication> #include <QtSQL> int main (int argc, char *argv[]) {Qco    Reapplication A (argc, argv);    Qdebug () << Qsqldatabase::d rivers (); return a.exec ();}

Done...

This article is from the "Running Donkey" blog, please make sure to keep this source http://amgodchan.blog.51cto.com/9521586/1765340

Qt for WINDOWS:QT 5.5 MinGW statically compiled version made with MySQL

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.