0

I have an application that uses SQLite via Qt libraries (I mean QSqlDatabase). When I run this application from Qt Creator (both in Debug and Release configurations), all works as expected, but when I trying to start an application via .exe file manually, it crashes right after SQLite database operations. I already have "sqldrivers" directory with "qsqlite.dll" file right next to the executable. There's no exception, because I already have a try-catch block around the function that works with SQLite.

What am I doing wrong? How can I fix it?

I'm using Qt5 and MSVC-11.0

Thanks in advance.

FrozenHeart
  • 19,844
  • 33
  • 126
  • 242
  • Have you placed the SQLite database file alongside your exe? – Nejat May 12 '14 at 09:25
  • I have the hardcoded path inside my program. Also I noticed that QSqlDatabase::drivers functions doesn't return anything in case of manually launch of .exe file – FrozenHeart May 12 '14 at 09:30
  • Do you have "Qt5sql.dll" alongside your exe and "qsqlite.dll" inside "sqldrivers" folder? – Nejat May 12 '14 at 09:34
  • @FrozenHeart when the list that `QSqlDatabase::drivers()` returns is empty then the loading of the libraries failed for some reason. – Zaiborg May 12 '14 at 09:42
  • @Zaiborg Yep, but I can't understand the reason – FrozenHeart May 12 '14 at 09:46
  • when i had problems like this while deploying applications it was basically allways that some dll was incompatible or missing in the deployed file struct – Zaiborg May 12 '14 at 09:48

1 Answers1

0

It crashes ... due what? (access violation, assertion)

you can add some logging to see how far your code executes before refusing its job. using QTextStream, a redirected qDebug(), std::ofstream or even a fprintf() call will do.

btw Qt does not use exceptions due compatibility to some platforms ...

Donald Duck
  • 8,409
  • 22
  • 75
  • 99
Zaiborg
  • 2,492
  • 19
  • 28