开发者

Qt4 Program Crashing Unless SDK Installed

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.


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)


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜