fatal error: mysql.h: No such file or directory
-
@LeeH Silly reason to switch databases. But Postgres is good to use as well as mysql. Mysql is a quite a bit more powerful but if you don't need the power then postgres should be fine.
Spaces in paths are the bane of my existence. They always cause issues like this. One of the reasons I hate windows so much. They seem to insist on large paths with spaces in them, all the while having massive path limitations (255 chars without special consideration and using the \?\ syntax).. It's just annoying.
Anyway as @koahnig stated above it's pretty easy to fix since the problem is already identified. Just have to figure out the proper way to escape the spaces in the path. The double quoting suggested may work, or you may need 's. Assuming you even want to try mysql again, postgres should be fine unless you are aiming at enterprise level stuff, which I'm betting you're not.
-
Hi again, so I after trying postgres with pgAdmin, I decided that I really do want to continue with mysql and qt (i dunno call it preference) so the saga continues... XD
Anyway I have fixed the original header file problem by reinstalling mysql to the root without spaces. I also installed the 32 bit version as I had previously installed 64 bit. It seemed to be building, but now I got this error telling me permision is denied to lib direcory:
mingw32-make -f Makefile.Release all mingw32-make[1]: Entering directory 'C:/Qt/5.8/Src/qtbase/src/plugins/sqldrivers/mysql' g++ -Wl,-s -shared -Wl,-subsystem,windows -Wl,--out-implib,C:\Qt\5.8\Src\qtbase\plugins\sqldrivers\libqsqlmysql.a -o ..\..\..\..\plugins\sqldrivers \qsqlmysql.dll .obj/release/qsql_mysql.o .obj/release/main.o .obj/release/moc_qsql_mysql_p.o -LC:\utils\my_sql\my_sql\lib -LC:\utils\postgresql\pgsql\lib C:\MySQL\MySQL_Server_5.7\lib -LC:\Qt\5.8\mingw53_32\lib C:\Qt\5.8\mingw53_32\lib\libQt5Sql.a C:\Qt\5.8\mingw53_32\lib\libQt5Core.a -llibmysql .obj\release\qsqlmysql_resource_res.o C:/Qt/Tools/mingw530_32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find C:\MySQL\MySQL_Server_5.7\lib: Permission denied C:/Qt/Tools/mingw530_32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -llibmysql collect2.exe: error: ld returned 1 exit status Makefile.Release:65: recipe for target '..\..\..\..\plugins\sqldrivers\qsqlmysql.dll' failed mingw32-make[1]: *** [..\..\..\..\plugins\sqldrivers\qsqlmysql.dll] Error 1 mingw32-make[1]: Leaving directory 'C:/Qt/5.8/Src/qtbase/src/plugins/sqldrivers/mysql' Makefile:38: recipe for target 'release-all' failed mingw32-make: *** [release-all] Error 2
I don't understand this because my windows account is admin level. I have run cmd as admin, tried setting lib path to environment variables, and checking permissions of folder. Any ideas?
-
@LeeH said in fatal error: mysql.h: No such file or directory:
-LC:\utils\postgresql\pgsql\lib C:\MySQL\MySQL_Server_5.7\lib
First: why do you have PostgreSQL stuff there?
Second: C:\MySQL\MySQL_Server_5.7\lib is just hanging around without any parameters, why? This way system tryes to execute this path, but since it is a directory it cannot be executed and you see that error message.-LC:\utils\postgresql\pgsql\lib C:\MySQL\MySQL_Server_5.7\lib
How did you call configure?
Are you trying to build from a clean state (looks like you're not)? -
@LeeH said in fatal error: mysql.h: No such file or directory:
-llibmysql
Also this is wrong:
-llibmysql
It must be:
-lmysql
-
Hi
First: I have no idea why postgres stuff is being used here, I wondered the same thing myself... and I had uninstalled postgres (through control panel) prior to my updated post but it never removed the folders
Second: the call i make is as in my original post but without spaces and from the root:
qmake "INCLUDEPATH+=C:/MySQL/MySQL_Server_5.7/include" "LIBS+=C:/MySQL/MySQL_Server_5.7/lib" mysql.pro
I also tried to add libmysql.lib as it is in the lib directory:
qmake "INCLUDEPATH+=C:/MySQL/MySQL_Server_5.7/include" "LIBS+=C:/MySQL/MySQL_Server_5.7/lib/libmysql.lib" mysql.pro
-
Hi guys
Please ignore my last post I didn't understand what I needed to do for the lib folder. Thanks to @SGaist for clearing that up it has finally compiled without errors! I am new to this sort of thing and didn't really understand.
Thanks to all of you for your help!
-
You're welcome !
Since you have it working now, please mark the thread as solved using the "Topic Tools" button so that other forum users may know a solution has been found :)