[SOLVED]Trying to build mysql driver in Qt 5.1.0 and MySQL 5.6



  • Hello everybody! I need your assistance! I can't connect qt 5.1.0 and mysql 5.6. Qt says that i don't have a QMYSQL driver, and i have read that i have to build mysql plugin myself, but i cant find a directory Src\Plugins\sqldrivers\mysql! It doesn't exist! Please help anybody


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    You should found them under qtbase/src/plugins/sqldrivers/mysql/



  • thanks! i have found them but i don't have mysql.pro file, and what should it contain?



  • [quote author="SGaist" date="1373404293"]Hi and welcome to devnet,

    You should found them under qtbase/src/plugins/sqldrivers/mysql/[/quote]

    thanks! i have found them but i don’t have mysql.pro file, and what should it contain?


  • Lifetime Qt Champion

    Are you sure you have the sources installed ?



  • Hi!

    As SGalst has said you is that you must download the Qt sources. In addition, you must download the source code of MySQL from its webpage.

    The next step is to open the mysql.pro, add the following lines:

    @LIBS += mysql/path/lib/libmysql.lib
    INCLUDEPATH += mysql/path/include@

    Then, you onyle have to compile in debug mode and in release mode. It provide you two files (I don't remember the exactly name) in both cases: [libqsqlmysqld.a, qsqlmysqld.dll] and [libqsqlmysql.a, qsqlmysql4.dll].

    You have to copy them into the sqldrivers dir of Qt non-source path.


  • Lifetime Qt Champion

    Little correction, you don't need the MySQL sources, the standard package should contain the libs and includes.



  • Thanks you! :)



  • [quote author="francescmm" date="1373443489"]Hi!

    As SGalst has said you is that you must download the Qt sources. In addition, you must download the source code of MySQL from its webpage.

    The next step is to open the mysql.pro, add the following lines:

    @LIBS += mysql/path/lib/libmysql.lib
    INCLUDEPATH += mysql/path/include@

    Then, you onyle have to compile in debug mode and in release mode. It provide you two files (I don't remember the exactly name) in both cases: [libqsqlmysqld.a, qsqlmysqld.dll] and [libqsqlmysql.a, qsqlmysql4.dll].

    You have to copy them into the sqldrivers dir of Qt non-source path.[/quote]

    when i am trying to make a mysql.pro by command "mingw32-make" it show me a lot of mistakes like: undefined reference to 'mysql_num_rows@4' and something like that.

    after all it says:
    c:/qt/qt5.1.0/tools/mingw48_32/bin/../lib/gcc/i686-w64-mingw32/4.8.0/../../../../i686-w64-mingw32/bin/ld.exe: .obj/release_shared/qsql_mysql.o: bad reloc address 0x4 in section `.data'
    collect2.exe: error: ld returned 1 exit status
    Makefile.Release:80: recipe for target '........\plugins\sqldrivers\qsqlmysql.dll' failed
    mingw32-make[1]: *** [........\plugins\sqldrivers\qsqlmysql.dll] Error 1
    mingw32-make[1]: Leaving directory 'C:/Qt/Qt5.1.0/5.1.0/Src/qtbase/src/plugins/sqldrivers/mysql'
    makefile:38: recipe for target 'release-all' failed
    mingw32-make: *** [release-all] Error 2



  • It is because the folder you are including in both INCLUDEPATH and LIBS have not the necessary CPP files. Are you sure you have all the sources?

    Try downloading: "MySQL Connector":http://dev.mysql.com/downloads/connector/c/



  • [quote author="francescmm" date="1373465557"]It is because the folder you are including in both INCLUDEPATH and LIBS have not the necessary CPP files. Are you sure you have all the sources?

    Try downloading: "MySQL Connector":http://dev.mysql.com/downloads/connector/c/[/quote]

    yes, I am sure that i have all sources, should I setup environment variables???
    may be it is because i have win8 x64 but my mingw x32 and qt5.1.0 x32???



  • Thanks very much everybody! The problem is solved :)


  • Lifetime Qt Champion

    Great !

    Then don't forget to update the thread's title to solved, so other forum users may know a solution has been found :)



  • Hello,

    It would have been nice to tell us how you solved your problem koresaram777.

    Indeed, I follow every indication, download the C connector sources archives and then the C++ one, but still, I can't compile the plugin. There is no C++ file into those archive (only headers files).

    I did some research but every time I have got a topic that says a different way. And I always still have those error messages:

    undefined references to mysql_num_rows@4, mysql_stmt_num_rows@4, etc.

    My computer is a 32bits so I only used (and download) the tools for 32bits. I say that because main of forum topic says that the problème come when using 64bits sources when the installed version of MySQL is 32bits.

    If someone can help me. Thanks.



  • [quote author="Vinorcola" date="1380787942"]Hello,

    It would have been nice to tell us how you solved your problem koresaram777.

    Indeed, I follow every indication, download the C connector sources archives and then the C++ one, but still, I can't compile the plugin. There is no C++ file into those archive (only headers files).

    I did some research but every time I have got a topic that says a different way. And I always still have those error messages:

    undefined references to mysql_num_rows@4, mysql_stmt_num_rows@4, etc.

    My computer is a 32bits so I only used (and download) the tools for 32bits. I say that because main of forum topic says that the problème come when using 64bits sources when the installed version of MySQL is 32bits.

    If someone can help me. Thanks.[/quote]

    when you download the c connector, you need to install it, after installation create the empty folder in c disk, after this just copy all you files from C:\Program Files\MySQL\Connector C++\ to your new folder, and rename this folder for example mySQL, but do it without spaces. and aflter that when you compile reference to that folder which you created before and that's all :)



  • I did what you said, but have still have the same error. Can someone help me? Or send me the compile plugin?

    Thanks



  • [quote author="Vinorcola" date="1380803548"]I did what you said, but have still have the same error. Can someone help me? Or send me the compile plugin?

    Thanks[/quote]

    give your email and what qt version do you have?



  • Hi,

    I've got some problems to compile Mysql driver, is something obvious for you ?

    @cd C:\Qt\Qt5.1.1\5.1.1\Src\qtbase\src\plugins\sqldrivers\mysql

    set mysql="C:\\PROGRA~1\\MySQL\\MYSQLS~1.6"

    qmake "INCLUDEPATH+=%mysql%\include\" "LIBS += -L %mysql%\lib\libmysql.lib" -o Makefile mysql.pro

    mingw32-make@

    @g++ -Wl,-s -shared -Wl,--out-implib,C:\Qt\Qt5.1.1\5.1.1\Src\qtbase\plugins\sqldr
    ivers\libqsqlmysql.a -o ........\plugins\sqldrivers\qsqlmysql.dll .obj/releas
    e_shared/main.o .obj/release_shared/qsql_mysql.o .obj/release_shared/moc_qsql_my
    sql_p.o -llibmysql -LC:\Qt\Qt5.1.1\5.1.1\mingw48_32\lib -lQt5Sql -lQt5Core
    c:/qt/qt5.1.1/tools/mingw48_32/bin/../lib/gcc/i686-w64-mingw32/4.8.0/../../../..
    /i686-w64-mingw32/bin/ld.exe: cannot find -llibmysql
    collect2.exe: error: ld returned 1 exit status
    Makefile.Release:80: recipe for target '........\plugins\sqldrivers\qsqlmysql
    .dll' failed
    mingw32-make[1]: *** [........\plugins\sqldrivers\qsqlmysql.dll] Error 1
    mingw32-make[1]: Leaving directory 'C:/Qt/Qt5.1.1/5.1.1/Src/qtbase/src/plugins/s
    qldrivers/mysql'
    makefile:38: recipe for target 'release-all' failed
    mingw32-make: *** [release-all] Error 2@


  • Lifetime Qt Champion

    @ "LIBS += -L %mysql%\lib\libmysql.lib"@

    That's your problem, -L is to give a path not a library name



  • Thanks for your post's!

    I got an issue if I want to build my driver. I'm using qt 5.3 and mysql 5.6 (mysql-5.6.20-win32).

    I added mysql.pro to qt creator and add the following two lines to the .pro file:

    @
    LIBS += C:/mysql/mysql-5.6.20-win32lib/libmysql.lib
    INCLUDEPATH += C:/mysql/mysql-5.6.20-win32/include
    @

    I got the following errors if i want to compile the mysql project:

    C:\mysql\mysql-5.6.20-win32\include\mysql_com.h:320: error: C2146: Syntaxfehler: Fehlendes ';' vor Bezeichner 'fd'

    C:\mysql\mysql-5.6.20-win32\include\mysql_com.h:320: error: C4430: Fehlender Typspezifizierer - int wird angenommen. Hinweis: "default-int" wird von C++ nicht untersttzt.

    C:\mysql\mysql-5.6.20-win32\include\mysql_com.h:320: error: C2146: Syntaxfehler: Fehlendes ';' vor Bezeichner 'fd'

    C:\mysql\mysql-5.6.20-win32\include\mysql_com.h:320: error: C4430: Fehlender Typspezifizierer - int wird angenommen. Hinweis: "default-int" wird von C++ nicht untersttzt.

    C:\work\build\qt5\qtbase\src\sql\drivers\mysql\qsql_mysql.cpp:44: error: C1083: Datei (Include) kann nicht ge”ffnet werden: "QtSql/private/qsqldriver_p.h": No such file or directory

    Many thanks for your help!


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Did you first build Qt 5 yourself ?



  • Hi SGaist,

    yes I built qt5 by my self. I also tried to build the drivers with the following commands (see http://qt-project.org/doc/qt-4.8/sql-driver.html#how-to-build-the-qmysql-plugin-on-windows):

    cd C:\work\build\qt5\qtbase\src\plugins\sqldrivers\mysql

    qmake "INCLUDEPATH+=C:\mysql\mysql-5.6.20-win32\include" "LIBS+=C:\mysql\mysql-5.6.20-win32\lib\libmysql.lib" mysql.pro

    mingw32-make

    If I do the "mingw32-make" command I got the following errors:

    C:\work\build\qt5\qtbase\src\plugins\sqldrivers\mysql>mingw32-make
    mingw32-make -f Makefile.Release all
    mingw32-make[1]: Entering directory 'C:/work/build/qt5/qtbase/src/plugins/sqldri
    vers/mysql'
    Makefile.Release:65: *** missing separator. Stop.
    mingw32-make[1]: Leaving directory 'C:/work/build/qt5/qtbase/src/plugins/sqldriv
    ers/mysql'
    mingw32-make[1]: Leaving directory 'C:/work/build/qt5/qtbase/src/plugins/sqldriv
    ers/mysql'
    Makefile:40: recipe for target 'release-all' failed
    mingw32-make: *** [release-all] Error 2


  • Lifetime Qt Champion

    You're on windows either escape the backslashes or since you are using Qt use the unix notation i.e. forward slashes



  • I'm working on a windows machine. You can see in my post that I'm setting the INCLUDEPATH and the LIBS with \

    What means this error exactly:

    Makefile.Release:65: *** missing separator. Stop.


  • Lifetime Qt Champion

    I know you are, and I already wrote the options you have:

    • escape the \ so in practice use \
    • Since you are using Qt use /

    Second option is cleaner.



  • Sorry for that stupid questions. I'm using the QT 5.4.0 64-bit for Desktop (MSVC 2013) command line.

    I got the same errors if I'm setting the paths like:

    qmake "INCLUDEPATH+=C:\mysql\mysql-5.6.20-win32\include" "LIBS+=C:\mysql\mysql-5.6.20-win32\lib\libmysql.lib" mysql.pro

    or:

    qmake "INCLUDEPATH+=C:/mysql/mysql-5.6.20-win32/include" "LIBS+=C:/mysql/mysql-5.6.20-win32/lib/libmysql.lib" mysql.pro

    or does it mean that I have to set the slashes in the Makefile.Release instead of \ to /

    Many thanks.



  • Ok, i was googling the problem. I get the error in the Makefile.Release in line 65:

    @{......\sql\drivers\mysql}.cpp{.obj\release}.obj::
    $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo.obj\release\ @<<
    $<
    <<@

    I get the error in line "<<"

    I add before "<<" a tab, so "\T<<". After I fired the mingw32-make command I still got the same problem. It seems to me that the Make.Release and Make.Debug files are generated each time if I do the mingw32-make command.

    Where can I set this behavior?


  • Lifetime Qt Champion

    First thing to do is to delete that folder content and restart



  • I have the same problem "Makefile.Release:65: *** missing separator"
    and i looked in Makefile.Release and didn't find missing separator)
    There were my steps:

    1. create folder [tempMySQL] with include and lib folders from mysqlserver folder
      It's look like this
      c:\qt\qt5.3.1\tempMySQL

    2. open mingw console and go to "C:\Qt\Qt5.3.1\5.3\Src\qtbase\src\plugins\sqldrivers\mysql"

    3. qmake "INCLUDEPATH+=C:\Qt\Qt5.3.1\tempMySQL\include" "LIBS+=C:\Qt\Qt5.3.1\tempMySQL\libmysql.lib" mysql.pro

    4. mingw32-make

    I didn't build Qt5.3.1 by myself, i just download
    Qt 5.3.1 for Windows 32-bit (MinGW 4.8.2, OpenGL, 737 MB) (Info) from here

    And when i worked with Qt 4.8.4 with VS2010 i didn't have a problem.
    I got all those steps then i describe above and it build and worked wihout any problem

    And of course i add mingw to PATH



  • remark: when i build this driver for Qt4.8.4 and VS2010 i used nmake, of course)


  • Lifetime Qt Champion

    Is libmysql.lib the static MySQL client lib ?



  • libmysql.lib it's static library. I got it from .../MySQL/MySQL Server 5.6/lib
    maybe i don't understand your question?


  • Lifetime Qt Champion

    Yes you understood it well. The thing is, on windows, static libraries and import libraries have the same extension but don't work the same. And furthermore, you can't mix mingw and MSVC libraries like that.

    Look at this "wiki entry":http://www.qtcentre.org/wiki/index.php?title=Building_the_QMYSQL_plugin_on_Windows_using_MinGW

    For the steps to use MinGW



  • The same result(((...

    BUT:
    I found that i have MySQL drivers with official build of QT5.3.2))) I have no idea why i didn't see it in first time and spent much time trying to build this drivers)).
    And firstly it didn't work too. Finally i put libmysql.dll into ...\Qt5.3.2\5.3\mingw482_32\bin and it works.!

    I think that problem with my own building of these drivers is that i have VS10, VS12, and MinGW compiler on one OS.... When i'll have free time, maybe in this everning i'll try to build it by mingw on virt. mach with Win7 without another compilers

    Remark: i don't have an idea why - but reimp util from MINGW Utils works only in old version (0.3)



  • This post is deleted!


  • Hello All,
    I do as following:
    C:\Qt\Qt5.1.1\5.1.1\Src\qtbase\src\plugins\sqldrivers\mysql>qmake "INCLUDEPATH+=C:\mySQL\include" "LIBS+=C:\mySQL\lib\libmysql.lib" mysql.pro

    C:\Qt\Qt5.1.1\5.1.1\Src\qtbase\src\plugins\sqldrivers\mysql>mingw32-make

    And go outpu like that:
    C:\Qt\Qt5.1.1\5.1.1\Src\qtbase\src\plugins\sqldrivers\mysql>mingw32-make
    mingw32-make -f Makefile.Release all
    mingw32-make[1]: Entering directory 'C:/Qt/Qt5.1.1/5.1.1/Src/qtbase/src/plugins/sqldrivers/mysql'
    C:\Qt\Qt5.1.1\5.1.1\mingw48_32\bin\moc.exe -DUNICODE -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCEPT
    release_shared" -I"........\mkspecs\win32-g++" main.cpp -o .moc\release_shared\main.moc
    g++ -c -pipe -fno-keep-inline-dllexport -O2 -std=c++0x -fno-exceptions -frtti -Wall -Wextra -DUNICODE -DQT_NO_CAS
    \QtCore\5.1.1\QtCore" -I".moc\release_shared" -I"........\mkspecs\win32-g++" -o .obj\release_shared\main.o mai
    C:\Qt\Qt5.1.1\5.1.1\mingw48_32\bin\moc.exe -DUNICODE -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCEPT
    release_shared" -I"........\mkspecs\win32-g++" ......\sql\drivers\mysql\qsql_mysql.cpp -o .moc\release_share
    g++ -c -pipe -fno-keep-inline-dllexport -O2 -std=c++0x -fno-exceptions -frtti -Wall -Wextra -DUNICODE -DQT_NO_CAS
    \QtCore\5.1.1\QtCore" -I".moc\release_shared" -I"........\mkspecs\win32-g++" -o .obj\release_shared\qsql_mysql
    C:\Qt\Qt5.1.1\5.1.1\mingw48_32\bin\moc.exe -DUNICODE -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCEPT
    release_shared" -I"........\mkspecs\win32-g++" ......\sql\drivers\mysql\qsql_mysql_p.h -o .moc\release_share
    g++ -c -pipe -fno-keep-inline-dllexport -O2 -std=c++0x -fno-exceptions -frtti -Wall -Wextra -DUNICODE -DQT_NO_CAS
    \QtCore\5.1.1\QtCore" -I".moc\release_shared" -I"........\mkspecs\win32-g++" -o .obj\release_shared\moc_qsql_m
    g++ -Wl,-s -shared -Wl,--out-implib,C:\Qt\Qt5.1.1\5.1.1\Src\qtbase\plugins\sqldrivers\libqsqlmysql.a -o ......
    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x17c): undefined reference to mysql_num_rows@4' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x1a7): undefined reference tomysql_stmt_num_rows@4'
    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x23c): undefined reference to mysql_num_rows@4' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x259): undefined reference tomysql_stmt_num_rows@4'
    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x29e): undefined reference to mysql_stmt_insert_id@4' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x2da): undefined reference tomysql_insert_id@4'
    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x374): undefined reference to mysql_thread_end@0' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x37f): undefined reference tomysql_close@4'
    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x7e8): undefined reference to mysql_character_set_name@4 .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x9c9): undefined reference tomysql_errno@4'
    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x9e0): undefined reference to mysql_field_seek@8' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0xa04): undefined reference tomysql_field_seek@8'
    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0xa0f): undefined reference to mysql_fetch_field@4' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0xa4f): undefined reference tomysql_fetch_field@4'
    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0xa81): undefined reference to mysql_error@4' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0xa90): undefined reference tomysql_errno@4'
    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0xc17): undefined reference to mysql_errno@4' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0xc51): undefined reference tomysql_stmt_error@4'
    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0xc5e): undefined reference to mysql_stmt_errno@4' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0xdda): undefined reference tomysql_query@8'
    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0xf1a): undefined reference to mysql_query@8' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x105a): undefined reference tomysql_query@8'
    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x1190): undefined reference to mysql_fetch_row@4' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x11d7): undefined reference tomysql_stmt_fetch@4'
    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x1372): undefined reference to mysql_list_fields@12' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x13cd): undefined reference tomysql_fetch_field@4'
    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x13dc): undefined reference to mysql_free_result@4' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x1ccc): undefined reference tomysql_init@4'
    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x1e1e): undefined reference to mysql_real_connect@32' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x2031): undefined reference tomysql_close@4'
    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x21ff): undefined reference to mysql_real_connect@32' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x2271): undefined reference tomysql_set_character_set@8
    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x2284): undefined reference to mysql_get_client_version@ .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x229d): undefined reference tomysql_thread_init@0'
    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x240d): undefined reference to mysql_select_db@8' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x253f): undefined reference tomysql_close@4'
    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x25eb): undefined reference to mysql_get_server_version@ .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x261b): undefined reference tomysql_options@12'
    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x26ce): undefined reference to mysql_stmt_data_seek@12' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x26df): undefined reference tomysql_stmt_fetch@4'
    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x2746): undefined reference to mysql_data_seek@12' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x2757): undefined reference tomysql_fetch_row@4'
    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x29ad): undefined reference to mysql_fetch_lengths@4' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x38d4): undefined reference tomysql_get_server_version@
    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x3d73): undefined reference to mysql_list_tables@8' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x3dbd): undefined reference tomysql_data_seek@12'
    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x3dc8): undefined reference to mysql_fetch_row@4' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x3fd0): undefined reference tomysql_free_result@4'
    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x4172): undefined reference to mysql_next_result@4' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x419a): undefined reference tomysql_store_result@4'
    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x41b4): undefined reference to mysql_field_count@4' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x420b): undefined reference tomysql_affected_rows@4'
    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x42a2): undefined reference to mysql_fetch_field_direct@ .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x441c): undefined reference tomysql_free_result@4'
    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x46bb): undefined reference to mysql_num_fields@4' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x47b2): undefined reference tomysql_fetch_field@4'
    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x48a4): undefined reference to mysql_stmt_result_metadat .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x48d7): undefined reference tomysql_free_result@4'
    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x48f8): undefined reference to mysql_next_result@4' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x4915): undefined reference tomysql_stmt_close@4'
    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x493b): undefined reference to mysql_free_result@4' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x49f4): undefined reference tomysql_store_result@4'
    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x4d52): undefined reference to mysql_real_query@12' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x4e43): undefined reference tomysql_store_result@4'
    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x4e68): undefined reference to mysql_field_count@4' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x4eaa): undefined reference tomysql_affected_rows@4'
    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x4f42): undefined reference to mysql_fetch_field_direct@ .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x5010): undefined reference tomysql_field_count@4'
    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x50f6): undefined reference to mysql_stmt_prepare@12' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x510f): undefined reference tomysql_stmt_param_count@4'
    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x5179): undefined reference to mysql_stmt_init@4' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x533a): undefined reference tomysql_stmt_param_count@4'
    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x540c): undefined reference to mysql_stmt_reset@4' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x560d): undefined reference tomysql_stmt_param_count@4'
    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x5626): undefined reference to mysql_stmt_execute@4' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x5785): undefined reference tomysql_stmt_affected_rows@
    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x57b5): undefined reference to mysql_stmt_bind_result@8' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x57d8): undefined reference tomysql_stmt_store_result@4
    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x5806): undefined reference to mysql_stmt_bind_result@8' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x584a): undefined reference tomysql_stmt_param_count@4'
    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x5bca): undefined reference to mysql_stmt_bind_param@8' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x609d): undefined reference tomysql_stmt_attr_set@12'
    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x6172): undefined reference to `mysql_real_escape_string@
    c:/qt/qt5.1.1/tools/mingw48_32/bin/../lib/gcc/i686-w64-mingw32/4.8.0/../../../../i686-w64-mingw32/bin/ld.exe: .ob
    collect2.exe: error: ld returned 1 exit status
    Makefile.Release:80: recipe for target '........\plugins\sqldrivers\qsqlmysql.dll' failed
    mingw32-make[1]: *** [........\plugins\sqldrivers\qsqlmysql.dll] Error 1
    mingw32-make[1]: Leaving directory 'C:/Qt/Qt5.1.1/5.1.1/Src/qtbase/src/plugins/sqldrivers/mysql'
    makefile:38: recipe for target 'release-all' failed
    mingw32-make: *** [release-all] Error 2

    Pleas help me.
    What Im doing wrong?


  • Lifetime Qt Champion

    Hi,

    Looks like your not linking to the MySQL library.

    LIBS+=-LC:/mySQL/lib -lmysql

    should be the correct syntax


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.