Qt中使用数据库时编译出错

来源:互联网 发布:java工程师和程序员 编辑:程序博客网 时间:2024/04/27 13:20

原文地址:http://os.chinaunix.net/a2008/0514/980/000000980029.shtml

error:QtSql:Nosuchfileordirectory

I wrote a program to test that how to connect to mysql with qt4,but I got the error message as follows when I compile it:

error: QtSql: No such file or directory

There are two method to solve this problem.

 

1.After execute qmake -project ,edit .pro file and add QT variable definition.

QT += sql

 

2.edit qmake configuration file,append QT variable definition

Just find the line like this:

QT += core gui network

change it :

QT += core gui network sql

 

原创粉丝点击