除非安装 SDK,否则 Qt4 程序崩溃

发布于 2024-09-28 00:28:09 字数 708 浏览 0 评论 0原文

我编写了一个开源程序,并使用 Qt4 LGPL SDK 构建为 GPL 版本。该程序能够搜索可选的 Sqlite3 数据库中的数据。

这就是让我失去理智的原因。我在开发机器上编译程序。当我尝试运行它时,我可能会遇到有关缺少 DLL 的错误。我将这些 dll 复制到与可执行文件相同的目录中,现在它可以正常工作( mingwm10.dll、libgcc_s_dw2-1.dll、QtCore4.dll、QtSql4.dll、QtGui4.dll ),包括数据库搜索。

现在,如果我将该文件夹与可执行文件和 DLL 复制到尚未安装 SDK 的新计算机上,它会正常运行,直到我尝试搜索。一旦我点击搜索按钮,我就会出现以下错误:

Title: Microsoft Visual C++ Runtime Library
Runtime Error!
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

然后我下载并安装了 SDK,什么也不做,我现在可以运行程序并搜索 sqlite3 文件了!

我缺少什么魔法?

PS两台机器都是新装的Windows XP系统。

I've written a Open Source program that I've released as GPL built using the Qt4 LGPL SDK. This program has the ability to search an optional Sqlite3 database for data.

Here is what is making me lose my mind. I compile the program on the development machine. When I try to run it, I can errors about missing DLLs. I copy those dlls into the same directory as the executable and it now works fine ( mingwm10.dll, libgcc_s_dw2-1.dll, QtCore4.dll, QtSql4.dll, QtGui4.dll ), including the database search.

Now, if I copy that folder with the executable and the DLLs to a new machine that has not had the SDK installed on it, it runs fine until I try to search. As soon as I hit the search button, I can the following error:

Title: Microsoft Visual C++ Runtime Library
Runtime Error!
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

I then download and install the SDK, doing nothing else, I can now run the program and search the sqlite3 file just fine!

What magic am I missing?

P.S. Both machines are freshly installed Windows XP systems.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

西瓜 2024-10-05 00:28:09

您可能有一些未部署到目标计算机的库或 Qt 插件。它很可能是 SQL 驱动程序插件。以下是有关它的一些信息: http://doc.trolltech.com/latest /deployment-windows.html#qt-plugins

您需要将所需的 Qt 插件复制到可执行文件旁边的目录中。并在您的 main() 中添加类似的内容:(

 QApplication::addLibraryPath(QCoreApplication::applicationDirPath() + "/plugins");

编辑链接并添加代码)

You may have some libs or Qt plugins that are not deployed to the target machine. It most likely is the SQL driver plugin. Here's some info about it: http://doc.trolltech.com/latest/deployment-windows.html#qt-plugins

You'll need to copy the needed Qt plugins to a directory next to your executable. And add something like this in your main():

 QApplication::addLibraryPath(QCoreApplication::applicationDirPath() + "/plugins");

(Edited link and added code)

£烟消云散 2024-10-05 00:28:09

我发现了问题。

Stephen Chu 是正确的,我缺少 sqlite 驱动程序。然而,我可能会遇到更多的复杂情况。

SDK 附带两套 dll。一组位于 $BASEDIR/bin 中,另一组位于 $BASEDIR/qt/bin 中。前者包含 Qt Creator 使用的 dll,而后者是您想要随可执行文件一起提供的 dll。

我需要获取 sqlite 插件 ( qsqlite4.dll ) 并将其复制到 APP_DIR/sqlplugins。我的问题是我使用了错误的 qsqlite4.dll 文件。

非常感谢所有对这个问题做出贡献的人。

为了将来参考,这里也讨论了这个问题: http://www.qtforum.org/article/34639/qt4-program-crashing-unless-sdk-installed.html

I found the problem.

Stephen Chu was correct in that I was missing the sqlite driver. However, I can into more complications along the way.

The SDK comes with two sets of dlls. One set resides in $BASEDIR/bin and the other in $BASEDIR/qt/bin. The former contains the dlls used by Qt Creator, while the latter are the dlls that you want to ship with your executable.

I needed to take the sqlite plugin ( qsqlite4.dll ) and copy it to APP_DIR/sqlplugins. My problem was I was using the wrong qsqlite4.dll file.

A big thanks to everyone who contributed to this question.

For future reference, this issue was also discussed here: http://www.qtforum.org/article/34639/qt4-program-crashing-unless-sdk-installed.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文