如何在 Qt Creator 中添加 QtSql 库?
当我编译具有数据库连接的代码时,出现错误,例如,
QtSql: No such file or directory
我认为sql库必须在Qt中,但我不知道为什么会发生错误? 如何启用数据库的库? 你能帮我吗,谢谢
when I compile the codes which has database connection, there's an error like,
QtSql: No such file 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
来自 QtSql 文档,
在您的
.pro
您必须添加的文件,据我所知,SQL 模块没有单独的库可供包含。如果您将以上行添加到您的
.pro
文件中就足够了。由于您不知道添加库,
来自 qmake 可以使用
LIBS
关键字添加文档、库。来自同一文档本身的示例..
From QtSql documentation,
In your
.pro
file you have to add,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..