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.

6
  • Have you placed the SQLite database file alongside your exe? Commented May 12, 2014 at 9: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 Commented May 12, 2014 at 9:30
  • Do you have "Qt5sql.dll" alongside your exe and "qsqlite.dll" inside "sqldrivers" folder? Commented May 12, 2014 at 9:34
  • @FrozenHeart when the list that QSqlDatabase::drivers() returns is empty then the loading of the libraries failed for some reason. Commented May 12, 2014 at 9:42
  • @Zaiborg Yep, but I can't understand the reason Commented May 12, 2014 at 9:46

1 Answer 1

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 ...

Sign up to request clarification or add additional context in comments.

2 Comments

It crashes right after QSqlDatabase::addDatabase function call. There is no messages / standard Windows message boxes / etc

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.