(SQLite + Qt + CodeBlock) 如何使这 3 个作品起作用?
我目前正在使用 Code::Block 做一个项目(原因:与 QtCreator 相比的可移植性。我无法在学校安装 QtCreator,所以我将 Code::Block 放入 USB 密钥中,它可以工作。)
这是我的查询:基于 Qt 的 GUI 应用程序来存储客户端。 如何存储客户? SQLite。
所以问题是:
我在尝试匹配这三个(QT、SQLite 和 CodeBlock)时出现了 37 个错误。所有错误看起来都一样(具有不同的数量和 QObject):
对“imp___ZN9QSqlQueryD1Ex”的未定义引用
我找到了我的问题的答案,部分。当你使用QtCreator+SQLite时:
在无法让它工作后,我检查了 Qt 社区论坛,似乎我所缺少的是
QT+=sql
在 .pro 文件中
这里是论坛帖子:http://developer.qt.nokia。 com/forums/viewthread/8262/
所以在尝试之后他所说的(在我的项目 QtCreator 中复制+粘贴),并将“QT += sql”添加到 QtCreator 中的 .pro 文件中,它就像一个魅力。
我仍然希望使用 Code::Block,并且没有 .pro 文件来执行此“魔术”。
有人有如何搭配 Qt+SQLite+CodeBlocks 的想法吗?
谢谢!
I am currently doing a project using Code::Block (Reason: portability compared to QtCreator. I can't install QtCreator at school so I put Code::Block in a USB Key and it works.)
Here is my query: Do a Qt based GUI app to store Clients.
How to store Clients? SQLite.
So here's the problem:
I have 37 errors while trying to match the three (QT, SQLite and CodeBlock). All errors look the same (with different number and QObjects):
undifined reference to 'imp___ZN9QSqlQueryD1Ex'
I found the answer to my question, part of. It is when you use QtCreator+SQLite:
After not getting it to work, I checked with the Qt Community Forum and it seems that all I was missing was
QT += sql
in the .pro file
Here is the forum post: http://developer.qt.nokia.com/forums/viewthread/8262/
So after trying what he said (copy+paste in QtCreator my project), and added "QT += sql" to the .pro file in QtCreator, it works like a charm.
Still I wish to use Code::Block, and there is no .pro files to do this "magic trick".
Anybody has ideas how to match Qt+SQLite+CodeBlocks?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不使用 C::B 但您应该能够链接到 QtSql 静态库。这基本上就是 AFAIK
QT += sql
在 .pro/QtCreator 端所做的事情。I don't use C::B but you should be able to link against the QtSql static library. This is essentially what for AFAIK
QT += sql
does on the .pro/QtCreator side.