C++ – Share a QT (trolltech) application with MySql (sql driver)
My last post was about creating the MySql driver for QT (trolltech).
But, I want to write a little post for people who, like I did, do want to share their QT Application with others. In fact, even if it works correctly on your computer, it is not the case on another one you have the (very ugly) : “SQL Driver is not loaded”, lets look at the solution…
When I shared my application with a friend, the program started without any error. But, when it tried to connect to the database it showed an error “Driver not loaded”. It was a surprise because, I put every dlls in the application directory : mingwm, mvscr90, qtcore, qtgui, qtsql,and also qsqlmysql4.
I checked with Dependency Walker no error were found…
But it was clear that something was missing… After some research, you have to copy every dll from C:\Qt\2009.X\qt\plugins\sqldrivers on the computer where you want to test your application. You have to use the same directory as usual plugins :
So copy sqldrivers dir into your executable dir. So near your executable, you must have usual dlls and sqldrivers directory (with every dll needed into it).
Then it will work.
If it doesn’t copy the sqldrivers dir in the same (original) path (for example C:\Qt\2009.X\qt\plugins\sqldrivers).
Good luck!
Subscribe to the RSS feed and have all new posts delivered straight to you.
