You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Wednesday, October 20th 2010, 6:39pm

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?


Thanks in advance.


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

pusty

Beginner

  • "pusty" is male

Posts: 20

Location: Poland

  • Send private message

2

Thursday, October 21st 2010, 10:50am

Haven't you forgotten about sql driver plugin?
Check if you can at least connect to the database on the machine without SDK.

3

Thursday, October 21st 2010, 12:53pm

Quoted

Haven't you forgotten about sql driver plugin?
Check if you can at least connect to the database on the machine without SDK.

I think you've hit on it right here. The plugin I need is qsqlite4.dll. How how the heck do I use it? Do I need to add code to my program to explicitly load it? I've been messing with putting it in different places and adding a qt.conf file for over an hour without luck

4

Thursday, October 21st 2010, 1:56pm

You need to copy it to [program directory]\sqldrivers\qsqlite4.dll
http://doc.qt.nokia.com/4.7/plugins-howt…ocating-plugins
http://doc.qt.nokia.com/4.7/plugins-howt…g-qt-extensions

Quoted


If you want the plugin to be loadable then one approach is to create a subdirectory under the application and place the plugin in that directory. If you distribute any of the plugins that come with Qt (the ones located in the plugins directory), you must copy the sub-directory under plugins where the plugin is located to your applications root folder (i.e., do not include the plugins directory).
Fighting fire with fire.
Three can keep a secret if two of them are dead.

5

Thursday, October 21st 2010, 3:12pm

I've tried that and it still crashed. I've tried putting the dll in the app directory in APP/plugins, APP/sqldrivers, and APP/plugins/sqldrivers. It crashes every time.

6

Thursday, October 21st 2010, 3:41pm

You do use Qt SDK. There is two sets of Qt dlls one built with MSVC (QtCreator and it's runtimes) other with mingw (for projects). Check out if you distribute right one. Never used SDK - don't know much.
http://www.thelins.se/johan/blog/2010/06/dlls-from-qt-sdk/

Quoted


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.


Check what sql drivers are available before using any http://doc.qt.nokia.com/4.7/qsqldatabase.html#drivers

Put many qDebug() << "bla bla"; in functions executed after search button is clicked. Use DebugView to see the output. Finally compile with "DEFINES += QT_NO_DEBUG_OUTPUT" (without ") in .pro file.

Check windows registry at HKEY_CURRENT_USER\Software\Trolltech if sqlite plugin is recognized.

Archive (or give link to) the program and sources.
Fighting fire with fire.
Three can keep a secret if two of them are dead.

7

Thursday, October 21st 2010, 3:43pm

Quoted


Finally compile with "DEFINES += QT_NO_DEBUG_OUTPUT" (without ") in .pro file.

After debugging naturally.
Fighting fire with fire.
Three can keep a secret if two of them are dead.

8

Thursday, October 21st 2010, 4:02pm

Quoted


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.
THIS. This was the solution. The entire time I was using the wrong sqlite4.dll. I put the correct sqlite.dll in APP_DIR/sqldrivers and now it works!

A huge thanks to everyone who contributed to this thread. I'm sure others will find it very helpful in the future.