i have here a linker problem with building the MySQL Driver in Qt 4.7.2
I have installed Qt 4.7.2 for VS2008 and MySQL 5.5.9 Community Edition, both in a path without spaces (C:\Qt, C:\MySQL). I take the commands from the Qt-Doc and creating the MakeFiles are no problem, there is only the message:
C:\Qt\4.7.2\src\plugins\sqldrivers\mysql>C:\Qt\4.7.2\bin\qmake "INCLUDEPATH+=C:\MySQL\include" "LIBS+=C:\MYSQL\lib\libmysql.lib" mysql.pro
WARNING: (internal):1: Unescaped backslashes are deprecated.
WARNING: (internal):1: Unescaped backslashes are deprecated.
WARNING: (internal):1: Unescaped backslashes are deprecated.
Then i run nmake and get following result:
C:\Qt\4.7.2\src\plugins\sqldrivers\mysql>nmake
Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
Copyright (C) Microsoft Corporation. All rights reserved.
"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\nmake.exe" -f Makefile.Debug
Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
Copyright (C) Microsoft Corporation. All rights reserved.
C:\Qt\4.7.2\bin\moc.exe -DUNICODE -DWIN32 -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 -DQ
T_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -I"..\..\..\..\include\QtCore" -I"..\..\..\..\include\QtSql" -I"..\..\..\..\include" -I"c:\MySQL\include" -I"..\..\..\..\include\ActiveQt
" -I"debug" -I"..\..\..\..\mkspecs\default" -D_MSC_VER=1500 -DWIN32 ..\..\..\sql\drivers\mysql\qsql_mysql.cpp -o debug\qsql_mysql.moc
C:\Qt\4.7.2\bin\moc.exe -DUNICODE -DWIN32 -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 -DQ
T_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -I"..\..\..\..\include\QtCore" -I"..\..\..\..\include\QtSql" -I"..\..\..\..\include" -I"c:\MySQL\include" -I"..\..\..\..\include\ActiveQt
" -I"debug" -I"..\..\..\..\mkspecs\default" -D_MSC_VER=1500 -DWIN32 ..\..\..\sql\drivers\mysql\qsql_mysql.h -o debug\moc_qsql_mysql.cpp
rc -D_DEBUG -DUNICODE -DWIN32 -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_HAVE_SSE2 -DQT_THREAD_SUPPORT -fo debug\qsqlmysqld_resource.res qsqlmysqld_resource.rc
Microsoft (R) Windows (R) Resource Compiler Version 6.1.6723.1
Copyright (C) Microsoft Corporation. All rights reserved.
cl -c -nologo -Zm200 -Zc:wchar_t- -Zi -MDd -GR -EHsc -W3 -w34100 -w34189 -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_DLL -DQT_PLUGIN -DQT_SQL_LI
B -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -I"..\..\..\..\include\QtCore" -I"..\..\..\..\include\QtSql" -I"..\..\..\..\include" -I"
c:\MySQL\include" -I"..\..\..\..\include\ActiveQt" -I"debug" -I"..\..\..\..\mkspecs\default" -Fodebug\ @C:\Users\MASTER~1\AppData\Local\Temp\nmF5B5.tmp
main.cpp
cl -c -nologo -Zm200 -Zc:wchar_t- -Zi -MDd -GR -EHsc -W3 -w34100 -w34189 -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_DLL -DQT_PLUGIN -DQT_SQL_LI
B -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -I"..\..\..\..\include\QtCore" -I"..\..\..\..\include\QtSql" -I"..\..\..\..\include" -I"
c:\MySQL\include" -I"..\..\..\..\include\ActiveQt" -I"debug" -I"..\..\..\..\mkspecs\default" -Fodebug\ @C:\Users\MASTER~1\AppData\Local\Temp\nmFE8C.tmp
qsql_mysql.cpp
cl -c -nologo -Zm200 -Zc:wchar_t- -Zi -MDd -GR -EHsc -W3 -w34100 -w34189 -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_DLL -DQT_PLUGIN -DQT_SQL_LI
B -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -I"..\..\..\..\include\QtCore" -I"..\..\..\..\include\QtSql" -I"..\..\..\..\include" -I"
开发者_如何学编程c:\MySQL\include" -I"..\..\..\..\include\ActiveQt" -I"debug" -I"..\..\..\..\mkspecs\default" -Fodebug\ @C:\Users\MASTER~1\AppData\Local\Temp\nm6E7.tmp
moc_qsql_mysql.cpp
link /LIBPATH:"c:\Qt\4.7.2\lib" /NOLOGO /DEBUG /DLL /MANIFEST /MANIFESTFILE:"debug\qsqlmysqld.intermediate.manifest" /VERSION:4.72 /OUT:debug\qsqlmysqld4.dll @C:\Users\MASTER~1\AppData\Local\T
emp\nmE28.tmp
Creating library debug\qsqlmysqld4.lib and object debug\qsqlmysqld4.exp
qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_fetch_field@4 referenced in function "public: bool __thiscall QMYSQLResultPrivate::bindInValues(void)" (?bindInValues@QMYSQLResultPriv
ate@@QAE_NXZ)
qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_num_fields@4 referenced in function "public: bool __thiscall QMYSQLResultPrivate::bindInValues(void)" (?bindInValues@QMYSQLResultPriva
te@@QAE_NXZ)
qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_stmt_result_metadata@4 referenced in function "public: bool __thiscall QMYSQLResultPrivate::bindInValues(void)" (?bindInValues@QMYSQLR
esultPrivate@@QAE_NXZ)
qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_stmt_close@4 referenced in function "protected: void __thiscall QMYSQLResult::cleanup(void)" (?cleanup@QMYSQLResult@@IAEXXZ)
qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_store_result@4 referenced in function "protected: void __thiscall QMYSQLResult::cleanup(void)" (?cleanup@QMYSQLResult@@IAEXXZ)
qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_next_result@4 referenced in function "protected: void __thiscall QMYSQLResult::cleanup(void)" (?cleanup@QMYSQLResult@@IAEXXZ)
qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_free_result@4 referenced in function "protected: void __thiscall QMYSQLResult::cleanup(void)" (?cleanup@QMYSQLResult@@IAEXXZ)
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)
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)
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)
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)
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)
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)
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
)
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@@MA
E_NXZ)
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)
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@QM
YSQLResult@@MAE_NABVQString@@@Z)
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@QMYSQLR
esult@@MAE_NABVQString@@@Z)
qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_field_count@4 referenced in function "protected: virtual bool __thiscall QMYSQLResult::reset(class QString const &)" (?reset@QMYSQLRes
ult@@MAE_NABVQString@@@Z)
qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_real_query@12 referenced in function "protected: virtual bool __thiscall QMYSQLResult::reset(class QString const &)" (?reset@QMYSQLRes
ult@@MAE_NABVQString@@@Z)
qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_errno@4 referenced in function "class QSqlError __cdecl qMakeError(class QString const &,enum QSqlError::ErrorType,class QMYSQLDriverP
rivate const *)" (?qMakeError@@YA?AVQSqlError@@ABVQString@@W4ErrorType@1@PBVQMYSQLDriverPrivate@@@Z)
qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_error@4 referenced in function "class QSqlError __cdecl qMakeError(class QString const &,enum QSqlError::ErrorType,class QMYSQLDriverP
rivate const *)" (?qMakeError@@YA?AVQSqlError@@ABVQString@@W4ErrorType@1@PBVQMYSQLDriverPrivate@@@Z)
qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_insert_id@4 referenced in function "protected: virtual class QVariant __thiscall QMYSQLResult::lastInsertId(void)const " (?lastInsertI
d@QMYSQLResult@@MBE?AVQVariant@@XZ)
qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_stmt_insert_id@4 referenced in function "protected: virtual class QVariant __thiscall QMYSQLResult::lastInsertId(void)const " (?lastIn
sertId@QMYSQLResult@@MBE?AVQVariant@@XZ)
qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_field_seek@8 referenced in function "protected: virtual class QSqlRecord __thiscall QMYSQLResult::record(void)const " (?record@QMYSQLR
esult@@MBE?AVQSqlRecord@@XZ)
qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_stmt_param_count@4 referenced in function "protected: virtual bool __thiscall QMYSQLResult::prepare(class QString const &)" (?prepare@
QMYSQLResult@@MAE_NABVQString@@@Z)
qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_stmt_prepare@12 referenced in function "protected: virtual bool __thiscall QMYSQLResult::prepare(class QString const &)" (?prepare@QMY
SQLResult@@MAE_NABVQString@@@Z)
qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_stmt_init@4 referenced in function "protected: virtual bool __thiscall QMYSQLResult::prepare(class QString const &)" (?prepare@QMYSQLR
esult@@MAE_NABVQString@@@Z)
qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_stmt_store_result@4 referenced in function "protected: virtual bool __thiscall QMYSQLResult::exec(void)" (?exec@QMYSQLResult@@MAE_NXZ)
qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_stmt_attr_set@12 referenced in function "protected: virtual bool __thiscall QMYSQLResult::exec(void)" (?exec@QMYSQLResult@@MAE_NXZ)
qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_stmt_bind_result@8 referenced in function "protected: virtual bool __thiscall QMYSQLResult::exec(void)" (?exec@QMYSQLResult@@MAE_NXZ)
qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_stmt_affected_rows@4 referenced in function "protected: virtual bool __thiscall QMYSQLResult::exec(void)" (?exec@QMYSQLResult@@MAE_NXZ
)
qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_stmt_execute@4 referenced in function "protected: virtual bool __thiscall QMYSQLResult::exec(void)" (?exec@QMYSQLResult@@MAE_NXZ)
qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_stmt_bind_param@8 referenced in function "protected: virtual bool __thiscall QMYSQLResult::exec(void)" (?exec@QMYSQLResult@@MAE_NXZ)
qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_stmt_reset@4 referenced in function "protected: virtual bool __thiscall QMYSQLResult::exec(void)" (?exec@QMYSQLResult@@MAE_NXZ)
qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_character_set_name@4 referenced in function "class QTextCodec * __cdecl codec(struct st_mysql *)" (?codec@@YAPAVQTextCodec@@PAUst_mysq
l@@@Z)
qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_thread_init@0 referenced in function "public: virtual bool __thiscall QMYSQLDriver::open(class QString const &,class QString const &,c
lass QString const &,class QString const &,int,class QString const &)" (?open@QMYSQLDriver@@UAE_NABVQString@@000H0@Z)
qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_get_server_version@4 referenced in function "public: virtual bool __thiscall QMYSQLDriver::open(class QString const &,class QString co
nst &,class QString const &,class QString const &,int,class QString const &)" (?open@QMYSQLDriver@@UAE_NABVQString@@000H0@Z)
qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_get_client_version@0 referenced in function "public: virtual bool __thiscall QMYSQLDriver::open(class QString const &,class QString co
nst &,class QString const &,class QString const &,int,class QString const &)" (?open@QMYSQLDriver@@UAE_NABVQString@@000H0@Z)
qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_set_character_set@8 referenced in function "public: virtual bool __thiscall QMYSQLDriver::open(class QString const &,class QString con
st &,class QString const &,class QString const &,int,class QString const &)" (?open@QMYSQLDriver@@UAE_NABVQString@@000H0@Z)
qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_options@12 referenced in function "public: virtual bool __thiscall QMYSQLDriver::open(class QString const &,class QString const &,clas
s QString const &,class QString const &,int,class QString const &)" (?open@QMYSQLDriver@@UAE_NABVQString@@000H0@Z)
qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_close@4 referenced in function "public: virtual bool __thiscall QMYSQLDriver::open(class QString const &,class QString const &,class Q
String const &,class QString const &,int,class QString const &)" (?open@QMYSQLDriver@@UAE_NABVQString@@000H0@Z)
qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_select_db@8 referenced in function "public: virtual bool __thiscall QMYSQLDriver::open(class QString const &,class QString const &,cla
ss QString const &,class QString const &,int,class QString const &)" (?open@QMYSQLDriver@@UAE_NABVQString@@000H0@Z)
qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_real_connect@32 referenced in function "public: virtual bool __thiscall QMYSQLDriver::open(class QString const &,class QString const &
,class QString const &,class QString const &,int,class QString const &)" (?open@QMYSQLDriver@@UAE_NABVQString@@000H0@Z)
qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_init@4 referenced in function "public: virtual bool __thiscall QMYSQLDriver::open(class QString const &,class QString const &,class QS
tring const &,class QString const &,int,class QString const &)" (?open@QMYSQLDriver@@UAE_NABVQString@@000H0@Z)
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)
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)
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)
qsql_mysql.obj : error LNK2019: unresolved external symbol _mysql_query@8 referenced in function "protected: virtual bool __thiscall QMYSQLDriver::beginTransaction(void)" (?beginTransaction@QMYSQLDriv
er@@MAE_NXZ)
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)
debug\qsqlmysqld4.dll : fatal error LNK1120: 50 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\link.EXE"' : return code '0x460'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\nmake.exe"' : return code '0x2'
Stop.
At the Qt-Doc is another path to the MySQL libs, but i changed that. I have no opt-Path, the libaries are in the folder above.
I have tried to build the plugin in VS2008/2010 Command Prompt, there is no difference.
Hope someone can help me, thanks
Installing the 32-bit version resolved the issue for me. But, do make sure that the previously installed version is removed completely and the Mysql service is not running. You can check this from Task Manager ->Services. You can stop the service if it is running already.
Installing mysql-5.5.33-win32.msi always resulted in a hang when performing Instance Configuration. So, i installed the zip and started mysql services manually.
MasterMito found solution himself:
Fixed the problem: Installed the 32Bit Version of MySQL-Server.
精彩评论