Qt4 connection to mysql

Source: Internet
Author: User

Qt4 is connected to the mysql running platform: win7 Compiler: vc IDE: vs2010 MYSQL: 5.5. If you forget it, you can leave it for others' reference. The dll and lib corresponding to www.2cto.com mysql are qsqlmysqld4.dll and qsqlmysqld4.lib. This is compiled. 1) first go to the cd % QTDIR % \ src \ plugins \ sqldrivers \ mysql directory, 2) run the command qmake-o Makefile "INCLUDEPATH + = C: \ MySQL \ include "" LIBS + = C: \ MySQL \ lib \ opt \ libmysql. lib "mysql. pro. Here, C: \ MySQL is the installation directory of mysql. There is no space in it. If there is a space, it cannot be compiled. At this time, you must copy the include and lib files in the mysql installation directory to another directory without spaces. For example, I copied them to D: \ work, then the above command becomes www.2cto.com qmake-o Makefile "INCLUDEPATH + = D: \ work \ include" "LIBS + = D: \ work \ lib \ libmysql. lib "mysql. pro 3) Run nmake. The required files qsqlmysqld4.dll and qsqlmysqld4.lib 4 are displayed under % QTDIR % \ src \ plugins \ sqldrivers \ mysql \ debug) copy the two files to % QTDIR % \ plugins \ sqldrivers.
 

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.