Solved MYSQL error in Qt
-
@Alfie-Anil edit the file : PATH_TO_QT_Src\qtbase\src\plugins\sqldrivers\mysql\mysql.pro in a text editor you prefer, you'll find a line QMAKE_USE +=mysql
add before it # , it'll be like this : #QMAKE_USE += mysql
save the file and procced with the next steps. -
@tmapp There is no reason to modify any qt source or config file when you want to compile a sql plugin...
-
@Christian-Ehrlicher that's how it worked with me on postgresql and mysql ; otherwise it'll display an error : mysql model is not defined , and same for postgresql ( speaking about QT 5.11 )
-
@tmapp Hi, I've tried that but nothing seems to be working. I'm still getting the same error
-
@Alfie-Anil said in MYSQL error in Qt:
Hi, I've tried that but nothing seems to be working. I'm still getting the same error
Not very helpful answer...
Please start with a clean qt source tree, follow the documentation and post the output. Also notice the comments to config.log in the documentation
-
Hello everyone, I was following through the documentation as suggested by @Christian-Ehrlicher . The first command I added was 'qmake -- MYSQL_INCDIR="C:/Program Files/MySQL/MySQL Connector C 6.1/include" MYSQL_LIBDIR="C:/Program Files/MySQL/MySQL Connector C 6.1/lib"
But the outcome was different to that which was in the documentation. This was what I got:
QMake has two modes, one mode for generating project files based on some heuristics, and the other for generating makefiles. Normally you shouldn't need to specify a mode, as makefile generation is the default mode for qmake, but you may use this to test qmake on an existing project Mode: -project Put qmake into project file generation mode In this mode qmake interprets [files] as files to be added to the .pro file. By default, all files with known source extensions are added. Note: The created .pro file probably will need to be edited. For example add the QT variable to specify what modules are required. -makefile Put qmake into makefile generation mode (default) In this mode qmake interprets files as project files to be processed, if skipped qmake will try to find a project file in your current working directory Warnings Options: -Wnone Turn off all warnings; specific ones may be re-enabled by later -W options -Wall Turn on all warnings -Wparser Turn on parser warnings -Wlogic Turn on logic warnings (on by default) -Wdeprecated Turn on deprecation warnings (on by default) Options: * You can place any variable assignment in options and it will be * * processed as if it was in [files]. These assignments will be * * processed before [files] by default. * -o file Write output to file -d Increase debug level -t templ Overrides TEMPLATE as templ -tp prefix Overrides TEMPLATE so that prefix is prefixed into the value -help This help -v Version information -early All subsequent variable assignments will be parsed right before default_pre.prf -before All subsequent variable assignments will be parsed right before [files] (the default) -after All subsequent variable assignments will be parsed after [files] -late All subsequent variable assignments will be parsed right after default_post.prf -norecursive Don't do a recursive search -recursive Do a recursive search -set <prop> <value> Set persistent property -unset <prop> Unset persistent property -query <prop> Query persistent property. Show all if <prop> is empty. -qtconf file Use file instead of looking for qt.conf -cache file Use file as cache [makefile mode only] -spec spec Use spec as QMAKESPEC [makefile mode only] -nocache Don't use a cache file [makefile mode only] -nodepend Don't generate dependencies [makefile mode only] -nomoc Don't generate moc targets [makefile mode only] -nopwd Don't look for files in pwd [project mode only]
Any ideas?
Thanks -
Hi,
You are likely not in the right folder, likely in your Qt installation rather than sources.
-
So I opened the terminal from the qt5.13.2 mingw32. Is that where i open the terminal from or is it another directory?
-
@Alfie-Anil said in MYSQL error in Qt:
Is that where i open the terminal from or is it another directory?
That's correct. But then you have to go to the correct source dir as you can see in the documentation: <srcdir>\qtbase\src\plugins\sqldrivers
Is it really that hard to follow the instructions? -
I've tried everything said but still comes up with the exact error.
-
@Alfie-Anil said in MYSQL error in Qt:
I've tried everything said but still comes up with the exact error.
Did you really call the correct qmake in the correct directory? I would guess no.
-
@Christian-Ehrlicher Yes I did. As stated in the documentation I cd to the correct directory and then followed the commands as given.
-
@Alfie-Anil The question was rather: did you call correct qmake?
To make sure you call correct qmake use absolute path (instead of simply calling qmake). -
So do you mean 'C:<NecessaryDirectory>? Yes
-
@Alfie-Anil Yes, absolute path like c:\Qt\5.12.0\mingw73_64\bin\qmake.exe
-
Yes That's what I did
-
@jsulm Actually I did get it working. But then I ran into the problem that although the problem was gone, none of the sql commands would not work so I was trying to fix that. Then, I ran into a problem with the computer which meant I had to reset the computer. So now I have to do it all over again (hahaha). (I've tried all the steps I did before)