Results 1 to 14 of 14

Thread: mysql driver and nmake error

  1. #1
    Join Date
    Jan 2008
    Posts
    8

    Default mysql driver and nmake error

    Hi All.
    I have a problem with building mysql driver for Qt under windows.i cannot build dll .
    i do follow steps. but after step 3 i.e after nmake i get such error
    Qt Code:
    1. link /LIBPATH:"c:\Qt\4.3.0-msvc2005\lib" /LIBPATH:"c:\Qt\4.3.0-msvc2005\
    2. lib" /NOLOGO /DEBUG /DLL /MANIFESTFILE:"tmp\obj\debug_shared\qsqlmysqld.intermed
    3. iate.manifest" /incremental:no /OUT:"..\..\..\..\plugins\sqldrivers\qsqlmysqld4.
    4. dll" @C:\DOCUME~1\COMP\LOCALS~1\Temp\nm8B.tmp
    5. Creating library ..\..\..\..\plugins\sqldrivers\qsqlmysqld4.lib and object ..
    6. \..\..\..\plugins\sqldrivers\qsqlmysqld4.exp
    7. qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_fetch_field re
    8. ferenced in function "public: bool __thiscall QMYSQLResultPrivate::bindInValues(
    9. void)" (?bindInValues@QMYSQLResultPrivate@@QAE_NXZ)
    10. qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_num_fields ref
    11. erenced in function "public: bool __thiscall QMYSQLResultPrivate::bindInValues(v
    12. oid)" (?bindInValues@QMYSQLResultPrivate@@QAE_NXZ)
    13. qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_stmt_result_me
    14. tadata referenced in function "public: bool __thiscall QMYSQLResultPrivate::bind
    15. InValues(void)" (?bindInValues@QMYSQLResultPrivate@@QAE_NXZ)
    16. qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_stmt_close ref
    17. erenced in function "protected: void __thiscall QMYSQLResult::cleanup(void)" (?c
    18. leanup@QMYSQLResult@@IAEXXZ)
    19. qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_store_result r
    20. eferenced in function "protected: void __thiscall QMYSQLResult::cleanup(void)" (
    21. ?cleanup@QMYSQLResult@@IAEXXZ)
    22. qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_next_result re
    23. ferenced in function "protected: void __thiscall QMYSQLResult::cleanup(void)" (?
    24. cleanup@QMYSQLResult@@IAEXXZ)
    25. qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_free_result re
    26. ferenced in function "protected: void __thiscall QMYSQLResult::cleanup(void)" (?
    27. cleanup@QMYSQLResult@@IAEXXZ)
    28. qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_fetch_row refe
    29. renced in function "protected: virtual bool __thiscall QMYSQLResult::fetch(int)"
    30. (?fetch@QMYSQLResult@@MAE_NH@Z)
    31. qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_data_seek refe
    32. renced in function "protected: virtual bool __thiscall QMYSQLResult::fetch(int)"
    33. (?fetch@QMYSQLResult@@MAE_NH@Z)
    34. qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_stmt_fetch ref
    35. erenced in function "protected: virtual bool __thiscall QMYSQLResult::fetch(int)
    To copy to clipboard, switch view to plain text mode 

    1.cd %QTDIR%\src\plugins\sqldrivers\mysql
    2.qmake -o Makefile "INCLUDEPATH+=C:\MySQL\include" "LIBS+=C:\MySQL\lib\opt\libmysql.lib" mysql.pro
    3.nmake

    p.s this is my environment variables.
    lib
    C:\Program Files\SQLXML 4.0\bin\;C:\Program Files\Microsoft Visual Studio 8\VC\lib;C:\Qt\4.3.0-msvc2005\lib;C:\mysql\lib\opt;
    Include
    C:\Program Files\Microsoft Visual Studio 8\VC\include;C:\mysql\include;
    path
    C:\Program Files\Microsoft Visual Studio 8\VC\bin;C:\Program Files\Microsoft SQL Server\80\Tools\Binn\;C:\Program Files\Microsoft SQL Server\90\DTS\Binn\;C:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\;C:\Progr am Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\;C:\WINDOWS\system 32;C:\Qt\4.3.0-msvc2005\bin;C:\MinGW\bin;C:\mysql\bin;

    QMAKESPEC
    win32-msvc2005

    QTDIR
    C:\Qt\4.3.0-msvc2005

    my qt version is
    qt-win-opensource-src-4.3.0.zip,mysql5,

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: mysql driver and nmake error

    Just to assure, does C:\MySQL\lib\opt\libmysql.lib exist?
    J-P Nurmi

  3. #3
    Join Date
    Jan 2008
    Posts
    8

    Default Re: mysql driver and nmake error

    sorry but where must be included this path C:\MySQL\lib\opt\libmysql.lib

  4. #4
    Join Date
    Jan 2008
    Posts
    8

    Default Re: mysql driver and nmake error

    in my env.varibale "libs" C:\MySQL\lib\opt\libmysql.lib this path are included

  5. #5
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: mysql driver and nmake error

    Quote Originally Posted by Ghost View Post
    sorry but where must be included this path C:\MySQL\lib\opt\libmysql.lib
    You're already passing it to qmake in step 1. I'm just asking whether this file actually exists? Because it looks like the linker is not actually linking against the library.
    J-P Nurmi

  6. #6
    Join Date
    Jan 2008
    Posts
    8

    Default Re: mysql driver and nmake error

    This libmysql.lib file actually exists by this C:\MySQL\lib\opt path.

  7. #7
    Join Date
    Jan 2008
    Posts
    8

    Default Re: mysql driver and nmake error

    Dear All
    how solve this linking problem?have nobody any idea?

  8. #8
    Join Date
    Feb 2008
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: mysql driver and nmake error

    i think some problems in mysql.pro... i got the same 71 unresolved links error (my past misstakes). i replaced it by original mysql.pro project file from C:\qt-win-opensource-src-4.3.1\scr\plugins\sqldriver\mysql. but then i made the following:
    1 .cd %QTDIR%\scr\plugins\sqldrivers\mysql
    2. qmake -project "INCLUDEPATH+=C:\MySql\include" "LIB+=C:\MySql\lib\opt\libmysql.lib" mysql.pro
    3. nmake

    there were no errors, in %QTDIR%\plugins\sqldrivers appeared new files for mysql driver, but sqlbrowser shows me only QSQLITE driver, and when i'm trying to
    QSqlDatabase db=QSqlDatabase::addDatabase("QMYSQL");

    "Driver not loaded" comes!!! i don't know what's wrong?

  9. #9
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: mysql driver and nmake error

    • dont' run "qmake -project" because it destroys the original and proper .pro file
    • it's LIBS not LIB, thus linking errors
    J-P Nurmi

  10. #10
    Join Date
    Feb 2008
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: mysql driver and nmake error

    Quote Originally Posted by jpn View Post
    • dont' run "qmake -project" because it destroys the original and proper .pro file
    • it's LIBS not LIB, thus linking errors
    oh, i've misstaken, i run "qmake -a Makefile and e.t.c., of course it'll crash my .pro file, but the problem is the same "Driver not loaded"

    yeah, and i wrote LIBS too, i made misstakes posting

    { 2 posts merged }
    Last edited by jpn; 15th February 2008 at 11:41.

  11. #11
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: mysql driver and nmake error

    You CAN'T re-create the .pro file as you like. Otherwise the plugin won't be built and you'll get such "Driver not loaded" due to missing plugin. You will have to restore the original .pro file and solve those linking errors. Assure that your MySQL installation has a) C:\MySql\include b) C:\MySql\lib\opt\libmysql.lib.
    J-P Nurmi

  12. #12
    Join Date
    Feb 2008
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: mysql driver and nmake error

    Quote Originally Posted by jpn View Post
    You CAN'T re-create the .pro file as you like. Otherwise the plugin won't be built and you'll get such "Driver not loaded" due to missing plugin. You will have to restore the original .pro file and solve those linking errors. Assure that your MySQL installation has a) C:\MySql\include b) C:\MySql\lib\opt\libmysql.lib.
    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE

    I've checked! Both a) and b) are on their places, i looked through google & noticed that i'm not the only person faced with this problem. Could it be connected with version of MySql??? First time it download MySql 5.1 alpha, then i tried MySql 4.1?

  13. #13
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: mysql driver and nmake error

    I suppose you have to add C:\MySql\opt\lib (or whereever the DLLs are) to PATH. Try opening %QTDIR%plugins/sqldrivers/qsqlmysql4.dll in Dependency Walker.
    J-P Nurmi

  14. #14
    Join Date
    Mar 2008
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: mysql driver and nmake error

    Hi, this is my new post. I had the same problem, I have the solution:


    cd c:\mysql\lib\opt (c:\mysql is where our MySQL is installed)
    reimp -d libmysql.lib (reimp comes with MinGW utilities)
    dlltool -k --input-def libmysql.def --dllname libmysql.dll --output-lib
    libmysql.a


    You have to download the mingw utilities (just google for it). Put them in your path.

    After that the link will go fine.

    ( more info on http://www.korone.net/bbs/board.php?...FWin32&page=14)

    Bye bye.

Similar Threads

  1. nmake problems while building mysql driver
    By MarkoSan in forum Installation and Deployment
    Replies: 27
    Last Post: 25th May 2007, 12:57

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.