qt5.6.0+vs2015 compiling Mqsql (ACCESS) X64 database driver

Source: Internet
Author: User
Tags sqlite

qt5.6.0+vs2015 compiling Mqsql ( ACCESS ) database-driven

1 description

L do not recommend QT5.6.0 using an access database. If you want to use a lightweight database, you can use the SQLite database .

QT wants access, SQL Server and other databases to be accessed through ODBC, but the higher QT version does not provide an ODBC driver library, and it needs to compile itself. The database driver compiled by QT5.6.0 is 64 bits, but it is not recommended to install an Access database, and Microsoft itself does not recommend installing 64-bit office.

PS: Why QT5.6.0 does not compile the 32-bit database driver: When compiling the database card driver, relying on Qt5Sql.lib, the library is 64-bit, after compiling 32 bits of the library, there are other dependent libraries need to recompile, obviously impossible.

Qt5Sql.lib (Qt5Sql.dll): Fatal error LNK1112: module machine Type "x64" and target computer

Type "X86" conflict

L QT5.6.0 provides database drivers for SQLite,MySql,Psql, and other database drivers that need to be compiled themselves.

See also: C:\Qt\Qt5.6.0\5.6\msvc2015_64\plugins\sqldrivers:

I have not seen the successful compilation of local database-driven tutorials, after exploring, the following MySQL driver as an example:

2 environment

QT5.6.0 + VS2015

3 compiling MySQL 64-bit Drive method 3.1 qmake-tp VC 3.1.1 Open qt Desktop

3.1.2 Enter C:\Qt\Qt5.6.0\5.6\Src\qtbase\src\plugins\sqldrivers\odbc directory, execute QMAKE-TP VC

c:\qt\qt5.6.0\5.6\msvc2015_64>CD C:\Qt\Qt5.6.0\5.6\Src\qtbase\src\plugins\sqldri

Vers\mysql

C:\qt\qt5.6.0\5.6\src\qtbase\src\plugins\sqldrivers\mysql>QMAKE-TP VC

Note: If you do not have this directory, when you install QT5.6.0, select Source to download the source code.

Description: The directive can generate the. vcproj project. When compiling with the command line, there are a variety of issues, or conversion to VS engineering Handy AH.

3.2 using VS2015 compilation to open the generated qsqlmysql.vcxproj

3.2.1 Set up an additional include directory that contains the directory where mysql.h is installed in MySQL.

3.2.2 Additional MYSLQ Library Libmysql.lib

3.2.3 Build Library

Generated files:

C:\Qt\Qt5.6.0\5.6\Src\qtbase\plugins\sqldrivers\qsqlmysql.dll

C:\Qt\Qt5.6.0\5.6\Src\qtbase\plugins\sqldrivers\qsqlmysqld.dll

3.2.4 Copy to QT database driver plugin Directory

Target directory: C:\Qt\Qt5.6.0\5.6\msvc2015_64\plugins\sqldrivers

3.2.5 to see if it was successful

3.3 Call MySQL, a lot of online data, slightly.

qt5.6.0+vs2015 compiling Mqsql (ACCESS) X64 database driver

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.