Ted
Ted

Reputation: 2239

How to include the qtsql module?

I am new to Qt and C++ (coming from the PHP world) and am stuck on something that is probably pretty obvious: including non-core Qt modules.

I (understandably) get the compile error that QSqlDatabase does not name a type.

I also get errors when I include either of the following:

Any idea how to include the QSql module? Thanks in advance.

Upvotes: 0

Views: 900

Answers (1)

duncan
duncan

Reputation: 6283

Add

QT += sql

To your .pro file to enable this module.

Be careful that you don't do

QT = ..

after the

QT += sql

Or simply put all the modules in one line:

QT = core gui sql

Upvotes: 2

Related Questions