Results 1 to 2 of 2

Thread: Building MySql driver

  1. #1
    Join Date
    Feb 2011
    Posts
    354
    Thanks
    17
    Thanked 26 Times in 23 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Windows

    Default Building MySql driver

    Hello. I am trying to build a MySQL driver on my Windows 8 x64 machine with Visual Studio 2008 the following way:
    1) From visual studio command prompt I cd to QTDIR\src\plugins\sqldrivers\mysql
    2) Edited mysql.pro to include paths to mysql.h and libmysql.lib:

    Qt Code:
    1. TARGET = qsqlmysql
    2.  
    3. # the following two lines were added
    4. INCLUDEPATH += "C:/Program Files/MySQL/MySQL Server 5.6/include"
    5. LIBS += "C:/Program Files/MySQL/MySQL Server 5.6/lib/libmysql.lib"
    6.  
    7. SOURCES = main.cpp
    8.  
    9. include(../../../sql/drivers/mysql/qsql_mysql.pri)
    10.  
    11. include(../qsqldriverbase.pri)
    To copy to clipboard, switch view to plain text mode 

    3) run qmake
    4) run nmake

    On the last step I get 50 unresolved externals and I have no idea what I am doing wrong:
    Qt Code:
    1. "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\nmake.exe" -f Makefile.Debug
    2. C:\Qt\4.8.5\bin\moc.exe -DUNICODE -DWIN32 -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_HAVE_SSE2 -DQT_THREAD_SUPPORT -I"c:\Qt\4.8.5\include\QtCore" -I"c:\Qt\4.8.5\include\QtSql" -I"c:\Qt\4.8.5\include" -I"c:\Program Files\MySQL\MySQL Server 5.6\include" -I"c:\Qt\4.8.5\include\ActiveQt" -I"debug" -I"c:\Qt\4.8.5\mkspecs\default" -D_MSC_VER=1500 -DWIN32 ..\..\..\sql\drivers\mysql\qsql_mysql.cpp -o debug\qsql_mysql.moc
    3. C:\Qt\4.8.5\bin\moc.exe -DUNICODE -DWIN32 -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_HAVE_SSE2 -DQT_THREAD_SUPPORT -I"c:\Qt\4.8.5\include\QtCore" -I"c:\Qt\4.8.5\include\QtSql" -I"c:\Qt\4.8.5\include" -I"c:\Program Files\MySQL\MySQL Server 5.6\include" -I"c:\Qt\4.8.5\include\ActiveQt" -I"debug" -I"c:\Qt\4.8.5\mkspecs\default" -D_MSC_VER=1500 -DWIN32 ..\..\..\sql\drivers\mysql\qsql_mysql.h -o debug\moc_qsql_mysql.cpp
    4. rc -D_DEBUG -DUNICODE -DWIN32 -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_HAVE_SSE2 -DQT_THREAD_SUPPORT -fo debug\qsqlmysqld_resource.res qsqlmysqld_resource.rc
    5. Microsoft (R) Windows (R) Resource Compiler Version 6.1.6723.1
    6.  
    7. Copyright (C) Microsoft Corporation. All rights reserved.
    8.  
    9.  
    10. cl -c -nologo -Zm200 -Zc:wchar_t- -Zi -MDd -GR -EHsc -W3 -w34100 -w34189 -DUNICODE -DWIN32 -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_HAVE_SSE2 -DQT_THREAD_SUPPORT -I"c:\Qt\4.8.5\include\QtCore" -I"c:\Qt\4.8.5\include\QtSql" -I"c:\Qt\4.8.5\include" -I"c:\Program Files\MySQL\MySQL Server 5.6\include" -I"c:\Qt\4.8.5\include\ActiveQt" -I"debug" -I"c:\Qt\4.8.5\mkspecs\default" -Fodebug\ @C:\Users\LANAME~1\AppData\Local\Temp\nm3AF2.tmp
    11. main.cpp
    12. cl -c -nologo -Zm200 -Zc:wchar_t- -Zi -MDd -GR -EHsc -W3 -w34100 -w34189 -DUNICODE -DWIN32 -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_HAVE_SSE2 -DQT_THREAD_SUPPORT -I"c:\Qt\4.8.5\include\QtCore" -I"c:\Qt\4.8.5\include\QtSql" -I"c:\Qt\4.8.5\include" -I"c:\Program Files\MySQL\MySQL Server 5.6\include" -I"c:\Qt\4.8.5\include\ActiveQt" -I"debug" -I"c:\Qt\4.8.5\mkspecs\default" -Fodebug\ @C:\Users\LANAME~1\AppData\Local\Temp\nm432D.tmp
    13. qsql_mysql.cpp
    14. cl -c -nologo -Zm200 -Zc:wchar_t- -Zi -MDd -GR -EHsc -W3 -w34100 -w34189 -DUNICODE -DWIN32 -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_HAVE_SSE2 -DQT_THREAD_SUPPORT -I"c:\Qt\4.8.5\include\QtCore" -I"c:\Qt\4.8.5\include\QtSql" -I"c:\Qt\4.8.5\include" -I"c:\Program Files\MySQL\MySQL Server 5.6\include" -I"c:\Qt\4.8.5\include\ActiveQt" -I"debug" -I"c:\Qt\4.8.5\mkspecs\default" -Fodebug\ @C:\Users\LANAME~1\AppData\Local\Temp\nm4DC9.tmp
    15. moc_qsql_mysql.cpp
    16. link /LIBPATH:"c:\Qt\4.8.5\lib" /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /DLL /MANIFEST /MANIFESTFILE:"debug\qsqlmysqld.intermediate.manifest" /VERSION:4.85 /OUT:debug\qsqlmysqld4.dll @C:\Users\LANAME~1\AppData\Local\Temp\nm570D.tmp
    17. Creating library debug\qsqlmysqld4.lib and object debug\qsqlmysqld4.exp
    18. qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_fetch_field@4 referenced in function "public: bool __thiscall QMYSQLResultPrivate::bindInValues(void)" (?bindInValues@QMYSQLResultPrivate@@QAE_NXZ)
    19. qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_num_fields@4 referenced in function "public: bool __thiscall QMYSQLResultPrivate::bindInValues(void)" (?bindInValues@QMYSQLResultPrivate@@QAE_NXZ)
    20. qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_stmt_result_metadata@4 referenced in function "public: bool __thiscall QMYSQLResultPrivate::bindInValues(void)" (?bindInValues@QMYSQLResultPrivate@@QAE_NXZ)
    21. qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_stmt_close@4 referenced in function "protected: void __thiscall QMYSQLResult::cleanup(void)" (?cleanup@QMYSQLResult@@IAEXXZ)
    22. qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_store_result@4 referenced in function "protected: void __thiscall QMYSQLResult::cleanup(void)" (?cleanup@QMYSQLResult@@IAEXXZ)
    23. qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_next_result@4 referenced in function "protected: void __thiscall QMYSQLResult::cleanup(void)" (?cleanup@QMYSQLResult@@IAEXXZ)
    24. qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_free_result@4 referenced in function "protected: void __thiscall QMYSQLResult::cleanup(void)" (?cleanup@QMYSQLResult@@IAEXXZ)
    25. qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_fetch_row@4 referenced in function "protected: virtual bool __thiscall QMYSQLResult::fetch(int)" (?fetch@QMYSQLResult@@MAE_NH@Z)
    26. qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_data_seek@12 referenced in function "protected: virtual bool __thiscall QMYSQLResult::fetch(int)" (?fetch@QMYSQLResult@@MAE_NH@Z)
    27. qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_stmt_fetch@4 referenced in function "protected: virtual bool __thiscall QMYSQLResult::fetch(int)" (?fetch@QMYSQLResult@@MAE_NH@Z)
    28. qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_stmt_data_seek@12 referenced in function "protected: virtual bool __thiscall QMYSQLResult::fetch(int)" (?fetch@QMYSQLResult@@MAE_NH@Z)
    29. qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_stmt_errno@4 referenced in function "class QSqlError __cdecl qMakeStmtError(class QString const &,enum QSqlError::ErrorType,struct st_mysql_stmt *)" (?qMakeStmtError@@YA?AVQSqlError@@ABVQString@@W4ErrorType@1@PAUst_mysql_stmt@@@Z)
    30. qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_stmt_error@4 referenced in function "class QSqlError __cdecl qMakeStmtError(class QString const &,enum QSqlError::ErrorType,struct st_mysql_stmt *)" (?qMakeStmtError@@YA?AVQSqlError@@ABVQString@@W4ErrorType@1@PAUst_mysql_stmt@@@Z)
    31. qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_num_rows@4 referenced in function "protected: virtual bool __thiscall QMYSQLResult::fetchLast(void)" (?fetchLast@QMYSQLResult@@MAE_NXZ)
    32. qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_stmt_num_rows@4 referenced in function "protected: virtual bool __thiscall QMYSQLResult::fetchLast(void)" (?fetchLast@QMYSQLResult@@MAE_NXZ)
    33. qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_fetch_lengths@4 referenced in function "protected: virtual class QVariant __thiscall QMYSQLResult::data(int)" (?data@QMYSQLResult@@MAE?AVQVariant@@H@Z)
    34. qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_fetch_field_direct@8 referenced in function "protected: virtual bool __thiscall QMYSQLResult::reset(class QString const &)" (?reset@QMYSQLResult@@MAE_NABVQString@@@Z)
    35. qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_affected_rows@4 referenced in function "protected: virtual bool __thiscall QMYSQLResult::reset(class QString const &)" (?reset@QMYSQLResult@@MAE_NABVQString@@@Z)
    36. ...
    37. qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_thread_end@0 referenced in function "public: virtual void __thiscall QMYSQLDriver::close(void)" (?close@QMYSQLDriver@@UAEXXZ)
    38. qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_list_tables@8 referenced in function "public: virtual class QStringList __thiscall QMYSQLDriver::tables(enum QSql::TableType)const " (?tables@QMYSQLDriver@@UBE?AVQStringList@@W4TableType@QSql@@@Z)
    39. qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_list_fields@12 referenced in function "public: virtual class QSqlRecord __thiscall QMYSQLDriver::record(class QString const &)const " (?record@QMYSQLDriver@@UBE?AVQSqlRecord@@ABVQString@@@Z)
    40. qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_query@8 referenced in function "protected: virtual bool __thiscall QMYSQLDriver::beginTransaction(void)" (?beginTransaction@QMYSQLDriver@@MAE_NXZ)
    41. qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_real_escape_string@16 referenced in function "public: virtual class QString __thiscall QMYSQLDriver::formatValue(class QSqlField const &,bool)const " (?formatValue@QMYSQLDriver@@UBE?AVQString@@ABVQSqlField@@_N@Z)
    42. debug\qsqlmysqld4.dll : fatal error LNK1120: 50 unresolved externals
    To copy to clipboard, switch view to plain text mode 

    I use Qt 4.8.5. I thought, maybe MySql driver sources shipped with that version are not compatible with the latest MySql lib (5.6.15)? Could somebody help me out?

  2. #2
    Join Date
    Feb 2011
    Posts
    354
    Thanks
    17
    Thanked 26 Times in 23 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Windows

    Default Re: Building MySql driver

    Fixed the issue myself. It looks like MySql 5.6 installer (not sure about previous versions) being itself 32 bit installs only 64 bit version of a client library for C development, therefore the driver could not link properly to libmysql.lib. In order to fix the issue, download the 32 bit version of Connector/C (libmysqlclient) and use those .lib and .dll files. Worked both with Qt 4.8.5 + Visual Studio 2008 and Qt 5.2.0 + Visual Studio 2012.

Similar Threads

  1. error building qt mysql driver
    By Capton in forum Newbie
    Replies: 1
    Last Post: 16th July 2013, 13:06
  2. source code for odbc driver or MySql driver in arm-embedded-linux
    By sattu in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 24th January 2011, 11:11
  3. I need MySQL driver for Qt 4.6, WindowsXP(32), MySQL 5.1
    By User_3 in forum Installation and Deployment
    Replies: 7
    Last Post: 15th October 2010, 16:19
  4. Building a static mysql driver
    By ThE_-_BliZZarD in forum Installation and Deployment
    Replies: 3
    Last Post: 15th October 2010, 12:56
  5. nmake problems while building mysql driver
    By MarkoSan in forum Installation and Deployment
    Replies: 27
    Last Post: 25th May 2007, 13:57

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.