[Solved] MySQL Driver C++
-
[quote author="Andre" date="1341843873"]Try setting Q_DEBUG_PLUGINS=1 in your environment when running your application. You will get debug info on plugin loading, including the sql drivers.[/quote]
Sorry, but where can i find this? Q_DEBUG_PLUGINS=1
-
You can set it as an environment variable. You can even do that directly from Qt creator: go to the Projects tab on the right side, and swich to the right project and the Run Settings (at the top of the tab). In the list of options, you'll find a Run Environment box. Expand it using the Details button on the right, and add the Q_DEBUG_PLUGINS variable to the list, giving it the value 1.
-
Thanks, i've found it.. But where can i find debug info? because it doesn't show up in "Application Output"
-
Sorry, my fault, it should be QT_DEBUG_PLUGINS.
-
This is the output (its on pastebin, couldn't post it here..)
-
That's a nice bunch of output. What does it tell you? I could of course analyze it for you, but the point is that it would be more useful for the both of us if you learn to do that yourself...
-
The output is what i understand, it tells me that the dll's and .a files are incompatible sortwise.
But why it is, is something i don't understand. I compiled it using MinGW..
What did i do wrong?
-
Let us first filter it down to the relevant entries, the ones about your mysql dll's:
[quote]
QFactoryLoader::QFactoryLoader() looking at "C:/QtSDK/Desktop/Qt/4.8.1/mingw/plugins/sqldrivers/qsqlmysql4.dll"
In C:/QtSDK/Desktop/Qt/4.8.1/mingw/plugins/sqldrivers/qsqlmysql4.dll:
Plugin uses incompatible Qt library
expected build key "Windows mingw debug full-config", got "Windows mingw release full-config"
"The plugin 'C:/QtSDK/Desktop/Qt/4.8.1/mingw/plugins/sqldrivers/qsqlmysql4.dll' uses incompatible Qt library. Expected build key "Windows mingw debug full-config", got "Windows mingw release full-config""
not a plugin
[/quote]
Ok, seems you are running a debug version of your app, with a debug Qt library, and that means you cannot load a release version... Makes sense, and the lack of a 'd' in the name of the library also indicates a release version. So far, no worries.
[quote]
QFactoryLoader::QFactoryLoader() looking at "C:/QtSDK/Desktop/Qt/4.8.1/mingw/plugins/sqldrivers/qsqlmysqld4.dll"
QLibraryPrivate::loadPlugin failed on "C:/QtSDK/Desktop/Qt/4.8.1/mingw/plugins/sqldrivers/qsqlmysqld4.dll" : "Cannot load library C:/QtSDK/Desktop/Qt/4.8.1/mingw/plugins/sqldrivers/qsqlmysqld4.dll: "
"Cannot load library C:/QtSDK/Desktop/Qt/4.8.1/mingw/plugins/sqldrivers/qsqlmysqld4.dll: "
could not load
[/quote]
Now it starts to get serious. Qt tried to load this plugin, but failed. The library failed to load, but it does not tell you why. Time to debug that further. Usually, when a library fails to load, it misses a dependency. So, get yourself a copy of the dependency walker tool to figure out what library the driver is trying to load and fails at. I can guess which one though: a core mysql library. Did you really follow the guide I linked to before? Including step 6? -
Thanks alot for your time !! really appreciated..
I remember i copied the 64 bit DLL version of libmysql.dll into C:\Windows
That was the problem, now i copied the 32bit, and it works.
Thanks!!
-
Please add a [Solved] tag to the topic title (by editing your first post in the topic) if you feel your problem has been solved.
-
Where will i get
libqsqlmysql4.a
libqsqlmysqld4.a