views:

446

answers:

4

I have a Qt exe built from visual studio 2005(after taking the .cpp, .h, .moc, ui_ files)

I have done some simple QSqlite queries. It works fine in my development pc. But in another pc it crashes for the line below:

                      QSqlDatabase mSqlDb

How to run the exe so that it can interact with sqlite from another pc. [Any other gui application runs just fine.]

So which things are necessary to deploy a sqlite-qt application ?

+2  A: 

I'd give you a better answer, but you tend to not accept answers, so here is a link to the documentation: Deploying an Application on Windows - Qt Plugins :)

Lukáš Lalinský
I like your style :)
Geo
A: 

I've just successfully compiled a static version (you have to compile it statically to avoid dependency problems) of a program that uses qt sqlite library with a MinGw compiler (bundled with Qt). Here are the steps that I used:

  1. Open command line and run c:\\bin\qtenv.bat
  2. The go to c:\\qt\
  3. and run this: "configure -static -release -nomake demo -nomake examples -no-exceptions -qt-sql-sqlite"
  4. Then run this: "mingw32-make src-sub"
  5. If you get some "phonon" error during compilation, then run "mingw32-make confclean" and then add "-no-phonon" parameter to command on 3. step and continue from there
  6. Wait for few hours
  7. Go to your project folder
  8. Run "qmake"
  9. Run "mingw32-make"
  10. Check the release folder, it should work

Good luck...

Damjan Kužnar
A: 

If you have Qt with shared libraries (standard compiled Qt download is Qt with shared libraries), you must follow this 2 easy steps:

1) tell QtCore to seach for plugins in 'your_directory' (use 'qApp->addLibraryPath(".")' to point into same directory, where your binary shall stay)

2) create subdirectory 'sqldrivers' in 'your_directory' and copy 'qsqlite4.dll' plugin in it (qsqlite4.dll plugin is in $$QT_DIR/plugins/sqldrivers/ directory)

Matriarch
A: 

Thanks Matriarch, that worked

hvranic