Unsolved Connect Qt to MySQL
-
This post is deleted! -
It give me :
Cannot find file: Files\MySQL\MySQL. Cannot find file: Server. Cannot find file: 5.7\include. Cannot find file: Files\MySQL\MySQL. Cannot find file: Server. Cannot find file: 5.7\lib\libmysql.lib. Cannot find file: mysql.pro.
I don't understand the line "Mysql.h : no such file or directory" in the error text, there is in fact a file named mysql.h in my folder "MySQL server 5.7\include"
-
Hi,
The best thing to do is to move your MySQL installation in a folder without any space in the path. Or use the 8.3 notation.
-
I did it, it resolved my first error, but it gives me a new one :
My lines :
cd C:\qt-everywhere-opensource-src-5.6.0\qtbase\src\plugins\sqldrivers\mysql set mysql=C:\MySQL\MySQL_Server_5.7 qmake "INCLUDEPATH+=%mysql%\include" "LIBS+=%mysql%\lib\libmysql.lib" mysql.pro mingw32-make
And the error :
mingw32-make[1]: Entering directory 'C:/qt-everywhere-opensource-src-5.6.0/qtbase/src/plugins/sqldrivers/mysql' g++ -Wl,-s -shared -Wl,-subsystem,windows -Wl,--out-implib,C:\qt-everywhere-opensource-src-5.6.0\qtbase\plugins\sqldrivers\libqsqlmysql.a -o ..\..\..\..\plugins\sqldrivers\qsqlmysql.dll .obj/release/main.o .obj/release/qsql_mysql.o .obj/release/moc_qsql_mysql_p.o C:\MySQL\MySQL_Server_5.7\lib\libmysql.lib -LC:/Qt/5.4/mingw491_32/lib -lQt5Sql542 -lQt5Core542 .obj\release\qsqlmysql_resource_res.o C:/Qt/Tools/mingw491_32/bin/../lib/gcc/i686-w64-mingw32/4.9.1/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lQt5Sql542 C:/Qt/Tools/mingw491_32/bin/../lib/gcc/i686-w64-mingw32/4.9.1/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lQt5Core542 collect2.exe: error: ld returned 1 exit status Makefile.Release:81: recipe for target '..\..\..\..\plugins\sqldrivers\qsqlmysql.dll' failed mingw32-make[1]: *** [..\..\..\..\plugins\sqldrivers\qsqlmysql.dll] Error 1 mingw32-make[1]: Leaving directory 'C:/qt-everywhere-opensource-src-5.6.0/qtbase/src/plugins/sqldrivers/mysql' makefile:38: recipe for target 'release-all' failed mingw32-make: *** [release-all] Error 2 Appuyez sur une touche pour continuer...
-
Looks like you are trying to build the Qt 5.6.0 sources with Qt 5.4.2 ?
-
Yes, I was, so I reinstall Qt 5.6, finally, and I get a (last?) error : The compiler is MSVC 2015, but at the line "nmake", i get a invalid command error
So I tried to call vcvarsall.bat, but I doesn't not change anything
(Yes i'm really a beginner) -
In your previous post I see: mingw32-make
That means you was using MinGW. Did you switch to MSVC2015?
Did you rerun qmake? -
Yes I have, I desinstalled Qt 5.5, and reinstall Qt 5.6, and now the Qt console is name MSVC 2015, but it don't recognized the line "nmake"...
Yes I rerun qmake -
Open a Visual Studio developer console, that will make thing easier. IIRC it should be in one of the subfolder of the Visual Studio Start menu entry.
-
I did it : qmake become invalid command, how do I set environnement to avoid it ?
-
Either use the full path to qmake or go to the Qt folder and IIRC there's a qtvars.bat file to setup the paths needed.
-
Ok perfect, I finally made it, but I don't understand where I have to put the dll to run a project with MySQL ?
-
@Detordreur like all sql plugin -> /sqldrivers
-
This is what i've done, in the folder of the executable, but when I try to compile this gives me :
(10061) QMYSQL : Unable to connect -
Isn't it rather when you run your application ?
If it can't connect, did you check your network settings ? Is your database running ?