How can I add the QtSql library in Qt creator?
when I compile the codes which has database connection, there's an error like,
QtSql: No such fil开发者_StackOverflow中文版e or directory
I suppose that the sql library must be in Qt, but I dont have any idea why an error occured ? what to do for enable the database's libraries? Can you help me please, thanks
From QtSql documentation,
In your .pro
file you have to add,
QT += sql
AFAIK there is no separate library to be included for SQL module. It's enough if you add the above line to your .pro
file.
Since you are not aware of adding libraries,
From qmake documentation, libraries can be added by using LIBS
keyword.
An example from the same documentation itself..
unix:LIBS += -lmath -L/usr/local/lib
win32:LIBS += c:\mylibs\math.lib
精彩评论