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 can I run the .exe
so that it can interact with sqlite
on another PC? [Other GUI application run just fine.]
What th开发者_StackOverflowings are necessary to deploy a sqlite-qt application?
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 :)
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)
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:
- Open command line and run c:\\bin\qtenv.bat
- The go to c:\\qt\
- and run this: "configure -static -release -nomake demo -nomake examples -no-exceptions -qt-sql-sqlite"
- Then run this: "mingw32-make src-sub"
- 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
- Wait for few hours
- Go to your project folder
- Run "qmake"
- Run "mingw32-make"
- Check the release folder, it should work
Good luck...
精彩评论