MySQL driver problem [Solved]



  • Hello i'm try to install the MySQL driver.
    According to the following instructions: "sql-driver":http://doc.qt.nokia.com/4.7/sql-driver.html
    Now I have everything downloaded, and then I need to run the following commands.
    reimp -d libmysql.lib

    But then I get the following error: reimp is not recognized internal or external command.
    Does anyone know what I might be doing wrong?

    Thanks,

    Wim

    I use:
    Windows 7 x64.
    Qt Creator 2.4.1 (Based on Qt 4.7.4 (32 bit)).



  • Hi, try this

    1. Install MySql server with libs (for exam C:\MySQL)
    2. Install QtSDK with source (for exam C:\QtSDK)
    3. Run Qt 4.7.3 for Desktop (mingw)
      @
      set QTDIR=C:\QtSDK\QtSource\

    set mySQLDIR=C:\MySQL

    cd %QTDIR%\src\plugins\sqldrivers\mysql

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

    mingw32-make
    @

    1. Go to %QTDIR%\src\plugins\sqldrivers\mysql and copy in
      C:\QtSQK\Desktop\Qt\4.7.3\mingw\plugins\sqldrivers 2 files - libqsqlmysqld4.a and qsqlmysqld4.dll.
    2. And from C:\MySQL\bin file libmysql.dll in dir C:\WINDOWS

    Test:
    qDebug() << QSqlDatabase::drivers();
    must be ("QSQLITE", "QMYSQL3", "QMYSQL")



  • hello
    This I also found on the Internet.
    But I do not know how to do Step 3.
    Should I make a new project with Qt Creator. Or something else?


  • Moderators

    I edited step 3 above for formatting. The individual steps had run together.



  • something else )

    Run (round button) - All programms - Qt SDK - Desktop - run Qt 4.7.4 for Desktop (mingw) - step 3



  • Thanks for the responses.

    I see now that I have Qt 4.8.0.
    If I try this code "QTDIR = C: \ QtSDK \ QtSource \ 4.8.0".
    I get the following error: "QTDIR is not recognized internal or external command,"


  • Moderators

    No, the command is:
    @
    set QTDIR=C:\QtSDK\QtSource\4.8.0
    @
    (mind the spaces)

    You're assigning "C:\QtSDK\QtSource\4.8.0" to a variable called "QTDIR"



  • be carefully
    not "QTDIR = C: \ QtSDK \ QtSource \ 4.8.0"

    must be "set QTDIR = C:\QtSDK\QtSource\4.8.0"





  • [quote author="Skyrim" date="1331767772"]be carefully
    not "QTDIR = C: \ QtSDK \ QtSource \ 4.8.0"

    must be "set QTDIR = C:\QtSDK\QtSource\4.8.0"[/quote]

    Yes that works.



  • Oh yes, its doesn't work.
    please write to

    "set QTDIR = C:\QtSDK\QtSource\4.8.0"



  • But now i have another error.!http://www.schuitemandev.nl/Images/Window1.jpg(Dos window)!


  • Moderators

    Is your QtSDK installed in C:\QtSDK, or E:\QtSDK? Your first "set" command is using E: not C:

    And it's supposed to be "set QTDIR= " not "set QTDIR- "

    Also, it should be "set mySQLDIR= " not "set mSQLDIR- "

    And when you do the "cd", it should take you to whatever directory has the "mysql.pro", not remain in system32.



  • My QtSDK is installed in E:\QtSDK.
    I have found mysql.pro in the map "E:\QtSDK\QtSources\4.8.0\src\plugins\sqldrivers\mysql".
    libmysql.lib in the map C:\MySQL\MySQL51\lib\opt.
    !http://www.schuitemandev.nl/Images/Window2.jpg(Window)!



  • I saw that I had forgotten something.
    !http://www.schuitemandev.nl/Images/Window3.jpg(window)!



  • I think I'm one step further.

    but I get 2 errors.
    @Setting up environment for Qt usage...

    C:\Windows\system32>set QTDIR = C:\QtSDK\QtSource\4.7.4

    C:\Windows\system32>set mySQLDIR=C:\MySQL

    C:\Windows\system32>cd %QTDIR%\src\plugins\sqldrivers\mysql
    Het systeem kan het opgegeven pad niet vinden.

    C:\Windows\system32>cd C:\QtSDK\QtSource\4.7.4\src\plugins\sqldrivers\mysql
    Het systeem kan het opgegeven pad niet vinden.

    C:\Windows\system32>QTDIR=C:\QtSDK\QtSources
    QTDIR wordt niet herkend als een interne
    of externe opdracht, programma of batchbestand.

    C:\Windows\system32>set QTDIR=C:\QtSDK\QtSources\4.7.4

    C:\Windows\system32>set mySQLDIR=C:\MySQL

    C:\Windows\system32>cd %QTDIR%\src\plugins\sqldrivers\mysql

    C:\QtSDK\QtSources\4.7.4\src\plugins\sqldrivers\mysql>qmake "INCLUDEPATH+=%mySQL
    DIR%\include" "LIBS+=%mySQLDIR%\lib\opt\libmysql.lib"-o Makefile mysql.pro
    WARNING: (internal):1: Unescaped backslashes are deprecated.
    c:\QtSDK\QtSources\4.7.4\src\plugins\sqldrivers\mysql\Makefile:9: Parse Error ('
    first: debug')
    Error processing project file: Makefile
    WARNING: (internal):1: Unescaped backslashes are deprecated.
    WARNING: (internal):1: Unescaped backslashes are deprecated.
    WARNING: (internal):1: Unescaped backslashes are deprecated.

    C:\QtSDK\QtSources\4.7.4\src\plugins\sqldrivers\mysql>mingw32-make
    mingw32-make -f Makefile.Debug
    mingw32-make[1]: Entering directory C:/QtSDK/QtSources/4.7.4/src/plugins/sqldri vers/mysql' g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT - DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_DLL -DQT_PLUGIN -DQT_SQL_LIB - DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_H AVE_SSE2 -DQT_THREAD_SUPPORT -I"c:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtCore" -I"c:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtSql" -I"c:\QtSDK\Desktop\Qt\4.7.4\m ingw\include" -I"c:\MySQL\include" -I"c:\QtSDK\Desktop\Qt\4.7.4\mingw\include\Ac tiveQt" -I"debug" -I"c:\QtSDK\Desktop\Qt\4.7.4\mingw\mkspecs\default" -o debug\m ain.o main.cpp C:\QtSDK\Desktop\Qt\4.7.4\mingw\bin\moc.exe -DUNICODE -DQT_LARGEFILE_SUPPORT -DQ T_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_DLL -DQT_PLUGIN -DQT_SQL_LIB -DQ T_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAV E_SSE2 -DQT_THREAD_SUPPORT -I"c:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtCore" -I "c:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtSql" -I"c:\QtSDK\Desktop\Qt\4.7.4\min gw\include" -I"c:\MySQL\include" -I"c:\QtSDK\Desktop\Qt\4.7.4\mingw\include\Acti veQt" -I"debug" -I"c:\QtSDK\Desktop\Qt\4.7.4\mingw\mkspecs\default" -D__GNUC__ - DWIN32 ..\..\..\sql\drivers\mysql\qsql_mysql.cpp -o debug\qsql_mysql.moc g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT - DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_DLL -DQT_PLUGIN -DQT_SQL_LIB - DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_H AVE_SSE2 -DQT_THREAD_SUPPORT -I"c:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtCore" -I"c:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtSql" -I"c:\QtSDK\Desktop\Qt\4.7.4\m ingw\include" -I"c:\MySQL\include" -I"c:\QtSDK\Desktop\Qt\4.7.4\mingw\include\Ac tiveQt" -I"debug" -I"c:\QtSDK\Desktop\Qt\4.7.4\mingw\mkspecs\default" -o debug\q sql_mysql.o ..\..\..\sql\drivers\mysql\qsql_mysql.cpp C:\QtSDK\Desktop\Qt\4.7.4\mingw\bin\moc.exe -DUNICODE -DQT_LARGEFILE_SUPPORT -DQ T_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_DLL -DQT_PLUGIN -DQT_SQL_LIB -DQ T_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAV E_SSE2 -DQT_THREAD_SUPPORT -I"c:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtCore" -I "c:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtSql" -I"c:\QtSDK\Desktop\Qt\4.7.4\min gw\include" -I"c:\MySQL\include" -I"c:\QtSDK\Desktop\Qt\4.7.4\mingw\include\Acti veQt" -I"debug" -I"c:\QtSDK\Desktop\Qt\4.7.4\mingw\mkspecs\default" -D__GNUC__ - DWIN32 ..\..\..\sql\drivers\mysql\qsql_mysql.h -o debug\moc_qsql_mysql.cpp g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT - DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_DLL -DQT_PLUGIN -DQT_SQL_LIB - DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_H AVE_SSE2 -DQT_THREAD_SUPPORT -I"c:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtCore" -I"c:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtSql" -I"c:\QtSDK\Desktop\Qt\4.7.4\m ingw\include" -I"c:\MySQL\include" -I"c:\QtSDK\Desktop\Qt\4.7.4\mingw\include\Ac tiveQt" -I"debug" -I"c:\QtSDK\Desktop\Qt\4.7.4\mingw\mkspecs\default" -o debug\m oc_qsql_mysql.o debug\moc_qsql_mysql.cpp windres -i qsqlmysqld_resource.rc -o debug\qsqlmysqld_resource_res.o --include-d ir=. -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_AS CII -DQT_DLL -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNO W -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT g++ -mthreads -shared -Wl,--out-implib,debug\libqsqlmysqld4.a -o debug\qsqlmysql d4.dll debug/main.o debug/qsql_mysql.o debug/moc_qsql_mysql.o -L"c:\QtSDK\Deskt op\Qt\4.7.4\mingw\lib" debug\qsqlmysqld_resource_res.o C:\MySQL\lib\opt\libmysql .lib-o -lQtSqld4 -lQtCored4 g++: C:\MySQL\lib\opt\libmysql.lib-o: No such file or directory mingw32-make[1]: *** [debug\qsqlmysqld4.dll] Error 1 mingw32-make[1]: Leaving directoryC:/QtSDK/QtSources/4.7.4/src/plugins/sqldriv
    ers/mysql'
    mingw32-make: *** [debug] Error 2

    C:\QtSDK\QtSources\4.7.4\src\plugins\sqldrivers\mysql>@



  • error in 24 line
    you line:
    @
    DIR%\include" "LIBS+=%mySQLDIR%\lib\opt\libmysql.lib"-o Makefile mysql.pro
    @
    must be
    @
    DIR%\include" "LIBS+=%mySQLDIR%\lib\opt\libmysql.lib" -o Makefile mysql.pro //need space before -o
    @



  • Hello
    I now work.
    I have Qt 4.8.0 removes. And 4.7.4. installed.
    Thanks everyone for the responses.

    Wim



  • Congratulations on your victory!


  • Moderators

    Be sure and edit your original post to add [Solved] to the title. Thanks!



  • hello:

    why my i have no QtSource subfolder under QtSDK folder and have no mysql sobfolder under sqldrivers folder? thank you!


Log in to reply
 

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