How to load QMYSQL driver using Qt 5.12 in Visual Studio?
-
I have been searching for this answer all along the forum and there is no answer working for me.
I am trying to follow this post of the Qt documentation.
- I do have the MySql Server 8.0 installed and inside it's folder I can find the libmysql.dll. There are the include and lib folders the ask for also.
- I also installed the C++ Connector, but there is nothing I can relate to what they ask me to do.
- I did go to the: <QTDIR>/5.12.6/msvc2017_64/plugins/sqldrivers and tried to execute the qmake they say but it doesn't work (it shows the usage help).
I do not know how to follow.
- Is it important that I am using Visual Studio instead of Qt Creator for this issue?
- What am I doing wrong with the qmake? Is the Qt documentation correct?
Thank you!
-
Hi and welcome to devnet,
Any chance that you did not download the Qt sources matching your version ?
-
@Aliwiki said in How to load QMYSQL driver using Qt 5.12 in Visual Studio?:
I did download the QT 5.12.6
5.12.6. does not provide a pre-build Qt mysql plugin anymore, you have to compile it by yourself: https://doc.qt.io/qt-5/sql-driver.html
-
@Aliwiki said in How to load QMYSQL driver using Qt 5.12 in Visual Studio?:
@SGaist said in How to load QMYSQL driver using Qt 5.12 in Visual Studio?:
Qt sources
What do you mena with the sources? I did download the QT 5.12.6 version and I have already run some small apps using it.
That's Qt pre-compiled for you. In order to compile the module you have to download the sources.
-
OK, I did understand I was not using the Qt sources and that was why the qmake didn't make sense. Now, I tried to execute it in the correct directory and I had this error:
C:\Qt\5.12.6\Src\qtbase\src\plugins\sqldrivers> qmake -- MYSQL_INCDIR="C:\Program Files\MySQL\MySQL Server 8.0\include" MYSQL_LIBDIR="C:\Program Files\MySQL\MySQL Server 8.0\lib" Project ERROR: Cannot run compiler 'cl'. Output: =================== =================== Maybe you forgot to setup the environment?
What am I doing wrong now?
-
@Aliwiki said in How to load QMYSQL driver using Qt 5.12 in Visual Studio?:
What am I doing wrong now?
Maybe you forgot to setup the environment?
Isn't this hint enough? You did not properly set up you compiler environment but simply opened cmd.exe instead the visual studio command prompt.