gpt4 book ai didi

mysql - 在 Qt 4.7.2 中构建 MySQL-Plugin 的问题

转载 作者:行者123 更新时间:2023-11-29 14:53:10 27 4
gpt4 key购买 nike

我在 Qt 4.7.2 中构建 MySQL 驱动程序时遇到链接器问题<​​/p>

我已经安装了 Qt 4.7.2 for VS2008 和 MySQL 5.5.9 Community Edition,两者都在没有空格的路径中(C:\Qt、C:\MySQL)。我从 Qt-Doc 获取命令并创建 MakeFiles 没有问题,只有消息:

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.

然后我运行 nmake 并得到以下结果:

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.

Qt-Doc 是 MySQL 库的另一个路径,但我更改了它。我没有 opt-Path,库位于上面的文件夹中。

我尝试过在VS2008/2010命令提示符下构建插件,没有什么区别。

希望有人能帮助我谢谢

最佳答案

安装 32 位版本解决了我的问题。但是,请确保之前安装的版本已完全删除并且 Mysql 服务未运行。您可以从“任务管理器”->“服务”中检查这一点。如果该服务已在运行,您可以停止该服务。

安装 mysql-5.5.33-win32.msi 在执行实例配置时总是会导致挂起。因此,我安装了 zip 并手动启动了 mysql 服务。

关于mysql - 在 Qt 4.7.2 中构建 MySQL-Plugin 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5299087/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com