Results 1 to 16 of 16

Thread: MySQL driver - Very strange problem. PLEASE HELP ME. Thanks.

  1. #1
    Join Date
    May 2009
    Posts
    28
    Qt products
    Qt3 Qt4 Qt/Embedded Qt Jambi PyQt3 PyQt4
    Platforms
    MacOS X Unix/X11 Windows

    Default MySQL driver - Very strange problem. PLEASE HELP ME. Thanks.

    Hi all.
    I am trying to connect Mysql with QT on Window XP.
    I made steps:
    1. Installed QT SDK
    2. Installed MySQL
    3. I run Qt Command Prompt to Build the QMYSQL Plugin on Windows.
    cd %QTDIR%\src\plugins\sqldrivers\mysql
    qmake "INCLUDEPATH+=C:\Program Files\MySQL\MySQL Server 5.0\include" "LIBS+=C:\Program Files\MySQL\MySQL Server 5.0\lib\opt\libmysql.lib" mysql.pro
    make
    (follow QTdocuments)

    it appears me a very strange message :
    ...
    In file included from main.cpp:44:
    ../../../sql/drivers/mysql/qsql_mysql.h:52:19: mysql.h: No such file or directory
    In file included from main.cpp:44:
    ../../../sql/drivers/mysql/qsql_mysql.h:107: error: expected `)' before '*' token
    make[1]: *** [debug/main.o] Error 1
    make[1]: Leaving directory `C:/Qt/2009.02/qt/src/plugins/sqldrivers/mysql'
    make: *** [debug] Error 2
    What happends with me? Please help me.

    Thanks.
    Diego.

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: MySQL driver - Very strange problem. PLEASE HELP ME. Thanks.

    I am 99% sure that is is a problem with the space in your INCLUDEPATH path. On windows always errors occure because of spaces in the paths. So reinstall MySQL in e.g. c:\mysql

  3. #3
    Join Date
    May 2009
    Posts
    28
    Qt products
    Qt3 Qt4 Qt/Embedded Qt Jambi PyQt3 PyQt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: MySQL driver - Very strange problem. PLEASE HELP ME. Thanks.

    Thanks Lykurg .

    I have just re-installed Mysql

    I run Qt Command Prompt to Build the QMYSQL Plugin on Windows.

    cd %QTDIR%\src\plugins\sqldrivers\mysql
    qmake "INCLUDEPATH+=C:\mysql\include" "LIBS+=C:\mysql\lib\opt\libmysql.lib" mysql.pro
    make
    It occurs to me a message :
    C:/Qt/2009.02/qt/src/plugins/sqldrivers/mysql/../../../sql/drivers/mysql/qsql_my
    sql.cpp:1419: undefined reference to `mysql_real_escape_string@16'
    collect2: ld returned 1 exit status
    make[1]: *** [debug\qsqlmysqld4.dll] Error 1
    make[1]: Leaving directory `C:/Qt/2009.02/qt/src/plugins/sqldrivers/mysql'
    make: *** [debug] Error 2
    Please help me.

    Thanks.
    Diego

  4. #4

    Exclamation Re: MySQL driver - Very strange problem. PLEASE HELP ME. Thanks.

    We seem to be experiencing the same problem.

    My company is currently experimenting with Qt for a future development strategy.

    This issue however has my bosses worried about Qt's ability to work with MySQL

    Could someone please look into this issue, cause we've been in this loop for the past week without any solution.

    Thanks in advance!

  5. #5
    Join Date
    Mar 2010
    Posts
    1
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: MySQL driver - Very strange problem. PLEASE HELP ME. Thanks.

    Hello everyone!

    I'm experiencing the same problem with my Qt and MySQL. Has anyone yet resolved this problem?

    qmake works properly... And as suggested, I used qmake lines from the help files, but still the make does not work properly.
    And the problem was:

    make
    ...
    %QTDIR//sqldrivers/mysql/qsql_mysql.h:107: error: expected `)' before '*' token
    make: *** [main.o] Error 1

    And the line 107 which the error message indicates has the following code:
    ..
    explicit QMYSQLDriver(MYSQL *con, QObject * parent=0);
    ..
    Last edited by grenkku; 22nd March 2010 at 12:14.

  6. #6
    Join Date
    Feb 2010
    Location
    Finland
    Posts
    7
    Thanks
    1
    Thanked 3 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: MySQL driver - Very strange problem. PLEASE HELP ME. Thanks.

    I also ran into many problems while trying to compile driver. I solved the problem by downloading mingw-utils 0.3. Add it to PATH variable
    Then few simple steps:

    cd e:\MySQL\lib\opt

    reimp -d libmysql.lib

    dlltool -k --input-def libmysql.def --dllname libmysql.dll --output-lib E:\Qt\2010.02\mingw\lib\libmysql.a

    reimp libmysql.lib

    cd e:\Qt\2010.02\qt\src\plugins\sqldrivers\mysql

    qmake "INCLUDEPATH+=E:\MySQL\include" "LIBS+=E:\MYSQL\lib\opt\libmysql.lib" mysql.pro

    mingw32-make

    NOTICE that reimp is used twice

  7. The following user says thank you to viheaho for this useful post:

    marx8926 (4th April 2010)

  8. #7
    Join Date
    Apr 2010
    Posts
    9
    Thanks
    1

    Default Re: MySQL driver - Very strange problem. PLEASE HELP ME. Thanks.

    I tried this solution and the solution in pdf in spanish but I still get these errors:
    [cut]
    tmp/obj/debug_shared/qsql_mysql.o:C:\Qt\qt\src\plugins\sqldrivers\mysql/../../..
    /sql/drivers/mysql/qsql_mysql.cpp:1430: undefined reference to `mysql_query@8'
    tmp/obj/debug_shared/qsql_mysql.o:C:\Qt\qt\src\plugins\sqldrivers\mysql/../../..
    /sql/drivers/mysql/qsql_mysql.cpp:1447: undefined reference to `mysql_query@8'
    tmp/obj/debug_shared/qsql_mysql.o:C:\Qt\qt\src\plugins\sqldrivers\mysql/../../..
    /sql/drivers/mysql/qsql_mysql.cpp:1464: undefined reference to `mysql_query@8'
    tmp/obj/debug_shared/qsql_mysql.o:C:\Qt\qt\src\plugins\sqldrivers\mysql/../../..
    /sql/drivers/mysql/qsql_mysql.cpp:1490: undefined reference to `mysql_real_escap
    e_string@16'
    collect2: ld returned 1 exit status
    mingw32-make[1]: *** [..\..\..\..\plugins\sqldrivers\qsqlmysqld4.dll] Error 1
    mingw32-make[1]: Leaving directory `C:/Qt/qt/src/plugins/sqldrivers/mysql'
    mingw32-make: *** [debug-all] Error 2

    Windows 7 x64, Qt 4.6

  9. #8
    Join Date
    Apr 2010
    Location
    Sudan
    Posts
    46
    Thanks
    7
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: MySQL driver - Very strange problem. PLEASE HELP ME. Thanks.

    i still have that errors too


    i am using :
    Windows 7 x86 Qt 4.6 MySQLServer 5.1

  10. #9
    Join Date
    Jun 2010
    Posts
    11
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: MySQL driver - Very strange problem. PLEASE HELP ME. Thanks.

    i have this problem too
    and i hope to find solution to this problem

  11. #10
    Join Date
    Jun 2010
    Location
    Salatiga, Indonesia
    Posts
    160
    Thanks
    11
    Thanked 32 Times in 29 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    1

    Default Re: MySQL driver - Very strange problem. PLEASE HELP ME. Thanks.

    This is how i build QMYSQL driver with MinGW/GCC.

    1. create directory C:\mysql, C:\mysql\include, and C:\mysql\lib
    2. copy mysql headers(*.h) to C:\mysql\include
    3. copy libmysql.lib to C:\mysql\lib
    4. use command prompt and change directory to C:\mysql\lib and run :
    > reimp -d libmysql.lib
    > dlltool -d libmysql.def -D libmysql.dll -l libmysql.a -k
    5. change directory to mysql driver plugin(for example C:\Qt\2010.03\qt\src\plugins\sqldrivers\mysql) and run:
    > qmake "INCLUDEPATH+=C:\mysql\include" "LIBS+=-LC:\mysql\lib -lmysql" mysql.pro
    > mingw32-make all

  12. #11
    Join Date
    Jun 2010
    Posts
    11
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: MySQL driver - Very strange problem. PLEASE HELP ME. Thanks.

    i get this problem
    hared/main.o tmp/obj/debug_shared/qsql_mysql.o tmp/obj/debug_shared/moc_qsql_mys
    ql.o -L"c:\Qt\2010.04\qt\lib" -L"c:\Qt\2010.04\qt\lib" tmp\obj\debug_shared\qsq
    lmysqld_resource_res.o -LC:\mysql\lib -lmysql -lQtSqld4 -lQtCored4
    c:/qt/2010.04/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe:
    cannot find -lmysql
    collect2: ld returned 1 exit status
    mingw32-make[1]: *** [..\..\..\..\plugins\sqldrivers\qsqlmysqld4.dll] Error 1
    mingw32-make[1]: Leaving directory `C:/Qt/2010.04/qt/src/plugins/sqldrivers/mysq
    l'
    mingw32-make: *** [debug-all] Error 2

    i get bored it have been about two weeks trying to build driver

  13. #12
    Join Date
    Jun 2010
    Location
    Salatiga, Indonesia
    Posts
    160
    Thanks
    11
    Thanked 32 Times in 29 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    1

    Default Re: MySQL driver - Very strange problem. PLEASE HELP ME. Thanks.

    do you have libmysql.a in C:\mysql\lib?

  14. #13
    Join Date
    Jan 2011
    Posts
    6
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: MySQL driver - Very strange problem. PLEASE HELP ME. Thanks.

    HELP ME!!!

    reimp -d libmysql.lib

    dlltool -k --input-def libmysql.def --dllname libmysql.dll --output-lib C:\Qt\2010.04\mingw\lib\libmysql.a

    reimp libmysql.lib

    cd e:\Qt\2010.04\qt\src\plugins\sqldrivers\mysql

    qmake "INCLUDEPATH+=C:\MySQL\include" "LIBS+=C:\MYSQL\lib\libmysql.lib" mysql.pro

    mingw32-make


    I get this problem:

    c:\Program Files\Microsoft Visual Studio\VC98\include/xstring: In constructor 's
    td::basic_string<_E, _Tr, _A>::basic_string(const _A&)':
    c:\Program Files\Microsoft Visual Studio\VC98\include/xstring:41: error: class '
    std::basic_string<_E, _Tr, _A>' does not have any field named 'allocator'
    c:\Program Files\Microsoft Visual Studio\VC98\include/xstring:41: error: there a
    re no arguments to '_Tidy' that depend on a template parameter, so a declaration
    of '_Tidy' must be available
    c:\Program Files\Microsoft Visual Studio\VC98\include/xstring:41: note: (if you
    use '-fpermissive', G++ will accept your code, but allowing the use of an undecl
    ared name is deprecated)
    c:\Program Files\Microsoft Visual Studio\VC98\include/xstring: In copy construct
    or 'std::basic_string<_E, _Tr, _A>::basic_string(const std::basic_string<_E, _Tr
    , _A>&)':
    c:\Program Files\Microsoft Visual Studio\VC98\include/xstring:43: error: class '
    std::basic_string<_E, _Tr, _A>' does not have any field named 'allocator'
    c:\Program Files\Microsoft Visual Studio\VC98\include/xstring:44: error: there a
    re no arguments to '_Tidy' that depend on a template parameter, so a declaration
    of '_Tidy' must be available
    c:\Program Files\Microsoft Visual Studio\VC98\include/xstring:44: error: 'npos'
    was not declared in this scope
    c:\Program Files\Microsoft Visual Studio\VC98\include/xstring: In constructor 's
    td::basic_string<_E, _Tr, _A>::basic_string(const std::basic_string<_E, _Tr, _A>
    &, int, int, const _A&)':
    c:\Program Files\Microsoft Visual Studio\VC98\include/xstring:47: error: class '
    std::basic_string<_E, _Tr, _A>' does not have any field named 'allocator'
    c:\Program Files\Microsoft Visual Studio\VC98\include/xstring:47: error: there a
    re no arguments to '_Tidy' that depend on a template parameter, so a declaration
    of '_Tidy' must be available
    c:\Program Files\Microsoft Visual Studio\VC98\include/xstring: In constructor 's
    td::basic_string<_E, _Tr, _A>::basic_string(const _E*, int, const _A&)':
    c:\Program Files\Microsoft Visual Studio\VC98\include/xstring:50: error: class '
    std::basic_string<_E, _Tr, _A>' does not have any field named 'allocator'
    c:\Program Files\Microsoft Visual Studio\VC98\include/xstring:50: error: there a
    re no arguments to '_Tidy' that depend on a template parameter, so a declaration
    of '_Tidy' must be available
    c:\Program Files\Microsoft Visual Studio\VC98\include/xstring: In constructor 's
    td::basic_string<_E, _Tr, _A>::basic_string(const _E*, const _A&)':
    c:\Program Files\Microsoft Visual Studio\VC98\include/xstring:52: error: class '
    std::basic_string<_E, _Tr, _A>' does not have any field named 'allocator'
    c:\Program Files\Microsoft Visual Studio\VC98\include/xstring:52: error: there a
    re no arguments to '_Tidy' that depend on a template parameter, so a declaration
    of '_Tidy' must be available
    c:\Program Files\Microsoft Visual Studio\VC98\include/xstring: In destructor 'st
    d::basic_string<_E, _Tr, _A>::~basic_string()':
    c:\Program Files\Microsoft Visual Studio\VC98\include/xstring:59: error: there a
    re no arguments to '_Tidy' that depend on a template parameter, so a declaration
    of '_Tidy' must be available
    c:\Program Files\Microsoft Visual Studio\VC98\include/xstring: In member functio
    n 'std::basic_string<_E, _Tr, _A>& std::basic_string<_E, _Tr, _A>::append(const
    std::basic_string<_E, _Tr, _A>&)':
    c:\Program Files\Microsoft Visual Studio\VC98\include/xstring:77: error: 'npos'
    was not declared in this scope
    c:\Program Files\Microsoft Visual Studio\VC98\include/xstring: In member functio
    n 'std::basic_string<_E, _Tr, _A>& std::basic_string<_E, _Tr, _A>::append(const
    std::basic_string<_E, _Tr, _A>&, int, int)':
    c:\Program Files\Microsoft Visual Studio\VC98\include/xstring:81: error: 'size_t
    ype' was not declared in this scope
    c:\Program Files\Microsoft Visual Studio\VC98\include/xstring:81: error: expecte
    d ';' before '_N'
    c:\Program Files\Microsoft Visual Studio\VC98\include/xstring:82: error: '_N' wa
    s not declared in this scope
    c:\Program Files\Microsoft Visual Studio\VC98\include/xstring:84: error: 'npos'
    was not declared in this scope
    c:\Program Files\Microsoft Visual Studio\VC98\include/xstring:84: error: '_Len'
    was not declared in this scope
    c:\Program Files\Microsoft Visual Studio\VC98\include/xstring:86: error: '_N' wa
    s not declared in this scope
    c:\Program Files\Microsoft Visual Studio\VC98\include/xstring:86: error: '_Len'
    was not declared in this scope
    c:\Program Files\Microsoft Visual Studio\VC98\include/xstring:87: error: '_Ptr'
    was not declared in this scope
    c:\Program Files\Microsoft Visual Studio\VC98\include/xstring:88: error: there a
    re no arguments to '_Eos' that depend on a template parameter, so a declaration
    of '_Eos' must be available
    c:\Program Files\Microsoft Visual Studio\VC98\include/xstring: In member functio
    n 'std::basic_string<_E, _Tr, _A>& std::basic_string<_E, _Tr, _A>::append(const
    _E*, int)':
    c:\Program Files\Microsoft Visual Studio\VC98\include/xstring:91: error: 'npos'
    was not declared in this scope
    c:\Program Files\Microsoft Visual Studio\VC98\include/xstring:91: error: '_Len'
    was not declared in this scope
    c:\Program Files\Microsoft Visual Studio\VC98\include/xstring:93: error: 'size_t
    ype' was not declared in this scope
    c:\Program Files\Microsoft Visual Studio\VC98\include/xstring:93: error: expecte
    d ';' before '_N'
    c:\Program Files\Microsoft Visual Studio\VC98\include/xstring:94: error: '_N' wa
    s not declared in this scope
    c:\Program Files\Microsoft Visual Studio\VC98\include/xstring:94: error: '_Len'
    was not declared in this scope
    c:\Program Files\Microsoft Visual Studio\VC98\include/xstring:95: error: '_Ptr'
    was not declared in this scope
    c:\Program Files\Microsoft Visual Studio\VC98\include/xstring:96: error: there a
    re no arguments to '_Eos' that depend on a template parameter, so a declaration
    of '_Eos' must be available
    In file included from ..\..\..\..\include/QtCore/../../src/corelib/global/qt_win
    dows.h:63,
    from ..\..\..\..\include/QtCore/qt_windows.h:1,
    from ../../../sql/drivers/mysql/qsql_mysql.h:49,
    from main.cpp:44:
    c:\Program Files\Microsoft Visual Studio\VC98\include/windows.h: At global scope
    :
    c:\Program Files\Microsoft Visual Studio\VC98\include/windows.h:30: error: expec
    ted unqualified-id before end of line
    c:\Program Files\Microsoft Visual Studio\VC98\include/windows.h:30: error: expec
    ted '}' before end of line
    c:\Program Files\Microsoft Visual Studio\VC98\include/windows.h:30: error: expec
    ted declaration before end of line
    mingw32-make.exe[1]: *** [tmp/obj/debug_shared/main.o] Error 1
    mingw32-make.exe[1]: Leaving directory `C:/Qt/2010.04/qt/src/plugins/sqldrivers/
    mysql'
    mingw32-make.exe: *** [debug-all] Error 2



    Please help meee!!!

  15. #14
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: MySQL driver - Very strange problem. PLEASE HELP ME. Thanks.

    let me guess, you are using the command prompt for MSVC, because it tries to use it even if you are intend to use MinGW. So either use the right command prompt or while running qmake use the -spec flag and set the right file.

  16. #15
    Join Date
    Jan 2011
    Posts
    6
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: MySQL driver - Very strange problem. PLEASE HELP ME. Thanks.

    Yes, I think that is the problem but MinGW is in : c:\qt\2010.04\mingw how can use MinGW command prompt, because I used QT command prompt and I get same error.

    or what file should I run to execute the right command prompt??


    or what can I do to use -spec flag?

    can you write a example please?
    Last edited by jfabian; 31st January 2011 at 05:02.

  17. #16
    Join Date
    Jan 2011
    Posts
    6
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: MySQL driver - Very strange problem. PLEASE HELP ME. Thanks.

    I resolved this problem uninstalling visual studio 6.0

Similar Threads

  1. Very Strange problem
    By dreamer in forum Qt Programming
    Replies: 1
    Last Post: 30th April 2008, 10:20
  2. Strange shortcut problem
    By blukske in forum Qt Programming
    Replies: 0
    Last Post: 13th March 2007, 11:26
  3. My Mysql 5 and Qt 4.2.2 Problem (Driver not loaded)
    By fengtian.we in forum Qt Programming
    Replies: 4
    Last Post: 9th February 2007, 09:11
  4. MySql plugin driver issues
    By stevey in forum Installation and Deployment
    Replies: 11
    Last Post: 20th September 2006, 14:45

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.