PDA

View Full Version : Build mysql driver for Qt5..5.1 for windows gives error:mysql.h: no such file or dir



GoranSimunic
8th March 2016, 11:32
Dear all,
i got this mistake when compiling driver by seppemagiels instructions on windows.

what is my mistake?
this is my Qt and mysql dir:

C:\Qt5\5.5\Src\qtbase\src\plugins\sqldrivers\mysql
C:\MySQL\MySQLServer5.5
both are 32 bit installations on 64bit machine

I have no spaces in dir name
I ran prompt as administrator...


Setting up environment for Qt usage...

C:\Qt5\5.5\mingw492_32>set mysql=C:\\PROGRA~2\\MySQL\\MYSQLS~1.5

C:\Qt5\5.5\mingw492_32>cd C:\Qt5\5.5\Src\qtbase\src\plugins\sqldrivers\mysql

C:\Qt5\5.5\Src\qtbase\src\plugins\sqldrivers\mysql>qmake "INCLUDEPATH+=%mysql%\\include" "LIBS+=%mysql%\\lib\\libmysql.lib" -o Makefile mysql.pro

C:\Qt5\5.5\Src\qtbase\src\plugins\sqldrivers\mysql>mingw32-make
mingw32-make -f Makefile.Release all
mingw32-make[1]: Entering directory 'C:/Qt5/5.5/Src/qtbase/src/plugins/sqldrivers/mysql'
g++ -c -pipe -fno-keep-inline-dllexport -Is:/include -O2 -std=c++0x -fno-exceptions -frtti -Wall -Wextra -DUNICODE -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I. -IC:/Utils/icu32_54_1_mingw492/include -IC:/openssl/include -IC
:/utils/postgresql/pgsql/include -IC:\PROGRA~2\MySQL\MYSQLS~1.5\include -IC:\Qt5\5.5\mingw492_32\include\QtCore\5.5.1 -IC:\Qt5\5.5\mingw492_32\include\QtCore\5.5.1\QtCor e -IC:\Qt5\5.5\mingw492_32\include\QtSql\5.5.1 -IC:\Qt5\5.5\mingw492_32\include\QtSql\5.5.1\QtSql -IC:\Qt5\5.5\mingw492_32\include
-IC:\Qt5\5.5\mingw492_32\include\QtSql -IC:\Qt5\5.5\mingw492_32\include\QtCore -I.moc\release -I..\..\..\..\mkspecs\win32-g++ -o .obj\release\main.o main.cpp
In file included from main.cpp:36:0:
../../../sql/drivers/mysql/qsql_mysql_p.h:55:19: fatal error: mysql.h: No such file or directory
#include <mysql.h>
^
compilation terminated.
Makefile.Release:476: recipe for target '.obj/release/main.o' failed
mingw32-make[1]: *** [.obj/release/main.o] Error 1
mingw32-make[1]: Leaving directory 'C:/Qt5/5.5/Src/qtbase/src/plugins/sqldrivers/mysql'
makefile:38: recipe for target 'release-all' failed
mingw32-make: *** [release-all] Error 2

C:\Qt5\5.5\Src\qtbase\src\plugins\sqldrivers\mysql>

anda_skoa
8th March 2016, 12:00
../../../sql/drivers/mysql/qsql_mysql_p.h:55:19: fatal error: mysql.h: No such file or directory

Just to be sure: you'vew verified that mysql.h is in one of the directories you've specified as include paths?

Cheers,
_

GoranSimunic
8th March 2016, 13:27
Im sorry that I do not understand your question well.
I dont see that I have include mysql.h somewhere

all I typed in command in prompt is:
set mysql=C:\\PROGRA~2\\MySQL\\MYSQLS~1.5
qmake "INCLUDEPATH+=C:/MySQL/include" "LIBS+=C:\MySQL\MySQLServer5.5\lib\libmysql.lib" mysql.pro
mingw32-make

I probably do not understand how did i include mysql.h?

Added after 50 minutes:

Dear all,
sorry for me being superficial...
I put wrong path to include as you mentioned. This one now is ok.

qmake "INCLUDEPATH+=C:/MySQL/MySQLServer5.5/include" "LIBS+=C:/MySQL/MySQLServer5.5/lib/libmysql.lib" mysql.pro

SOLVED so far...now i need to copy dll's to C:\Qt5\Tools\QtCreator\bin\plugins\sqldrivers
there is no qsqlmysqld.dll in my system, just this one qsqlmysql.dll

anda_skoa
8th March 2016, 13:29
Im sorry that I do not understand your question well.
I dont see that I have include mysql.h somewhere

I did not ask where you include the header, I asked whether it is in one of the include paths you've specified.
Shouldn't be too hard to point Explorer to those folders and check the list.



I probably do not understand how did i include mysql.h?

When the compiler reports an error, it is usually a good idea to look at the error message.

Cheers,
_

GoranSimunic
8th March 2016, 14:27
After building mysql driver is sucesuully done, I understand what you are asking.

So the answer is:
yes, I have included the wrong path :-)

thank you for helping me find mistake.

driver is built and it is working.:)