高分求助关于编译mysql驱动的错误

ghosty_hand 2012-09-04 01:20:04
1、按照大家普遍讲的方法编译

2、我安装mysql后,编辑.pro文件
INCLUDEPATH+="D:\MySQL\Connector C 6.0.2\include"
LIBS+="D:\MySQL\Connector C 6.0.2\lib\opt\libmysql.lib"

3、编译通过,链接时出现这么多错误:
qsql_mysql.obj : error LNK2019: 无法解析的外部符号 _mysql_fetch_field@4,该符号
在函数 "public: bool __thiscall QMYSQLResultPrivate::bindInValues(void)" (?bindI
nValues@QMYSQLResultPrivate@@QAE_NXZ) 中被引用
qsql_mysql.obj : error LNK2019: 无法解析的外部符号 _mysql_num_fields@4,该符号在
函数 "public: bool __thiscall QMYSQLResultPrivate::bindInValues(void)" (?bindInV
alues@QMYSQLResultPrivate@@QAE_NXZ) 中被引用
qsql_mysql.obj : error LNK2019: 无法解析的外部符号 _mysql_stmt_result_metadata@4
,该符号在函数 "public: bool __thiscall QMYSQLResultPrivate::bindInValues(void)"
(?bindInValues@QMYSQLResultPrivate@@QAE_NXZ) 中被引用
qsql_mysql.obj : error LNK2019: 无法解析的外部符号 _mysql_stmt_close@4,该符号在
函数 "protected: void __thiscall QMYSQLResult::cleanup(void)" (?cleanup@QMYSQLRe
sult@@IAEXXZ) 中被引用
qsql_mysql.obj : error LNK2019: 无法解析的外部符号 _mysql_store_result@4,该符号
在函数 "protected: void __thiscall QMYSQLResult::cleanup(void)" (?cleanup@QMYSQL
Result@@IAEXXZ) 中被引用
qsql_mysql.obj : error LNK2019: 无法解析的外部符号 _mysql_next_result@4,该符号
在函数 "protected: void __thiscall QMYSQLResult::cleanup(void)" (?cleanup@QMYSQL
Result@@IAEXXZ) 中被引用
qsql_mysql.obj : error LNK2019: 无法解析的外部符号 _mysql_free_result@4,该符号
在函数 "protected: void __thiscall QMYSQLResult::cleanup(void)" (?cleanup@QMYSQL
Result@@IAEXXZ) 中被引用
qsql_mysql.obj : error LNK2019: 无法解析的外部符号 _mysql_fetch_row@4,该符号在
函数 "protected: virtual bool __thiscall QMYSQLResult::fetch(int)" (?fetch@QMYSQ
LResult@@MAE_NH@Z) 中被引用
qsql_mysql.obj : error LNK2019: 无法解析的外部符号 _mysql_data_seek@12,该符号在
函数 "protected: virtual bool __thiscall QMYSQLResult::fetch(int)" (?fetch@QMYSQ
LResult@@MAE_NH@Z) 中被引用
qsql_mysql.obj : error LNK2019: 无法解析的外部符号 _mysql_stmt_fetch@4,该符号在
函数 "protected: virtual bool __thiscall QMYSQLResult::fetch(int)" (?fetch@QMYSQ
LResult@@MAE_NH@Z) 中被引用
qsql_mysql.obj : error LNK2019: 无法解析的外部符号 _mysql_stmt_data_seek@12,该
符号在函数 "protected: virtual bool __thiscall QMYSQLResult::fetch(int)" (?fetch
@QMYSQLResult@@MAE_NH@Z) 中被引用
qsql_mysql.obj : error LNK2019: 无法解析的外部符号 _mysql_stmt_errno@4,该符号在
函数 "class QSqlError __cdecl qMakeStmtError(class QString const &,enum QSqlErro
r::ErrorType,struct st_mysql_stmt *)" (?qMakeStmtError@@YA?AVQSqlError@@ABVQStri
ng@@W4ErrorType@1@PAUst_mysql_stmt@@@Z) 中被引用
qsql_mysql.obj : error LNK2019: 无法解析的外部符号 _mysql_stmt_error@4,该符号在
函数 "class QSqlError __cdecl qMakeStmtError(class QString const &,enum QSqlErro
r::ErrorType,struct st_mysql_stmt *)" (?qMakeStmtError@@YA?AVQSqlError@@ABVQStri
ng@@W4ErrorType@1@PAUst_mysql_stmt@@@Z) 中被引用
qsql_mysql.obj : error LNK2019: 无法解析的外部符号 _mysql_num_rows@4,该符号在函
数 "protected: virtual bool __thiscall QMYSQLResult::fetchLast(void)" (?fetchLas
t@QMYSQLResult@@MAE_NXZ) 中被引用
qsql_mysql.obj : error LNK2019: 无法解析的外部符号 _mysql_stmt_num_rows@4,该符
号在函数 "protected: virtual bool __thiscall QMYSQLResult::fetchLast(void)" (?fe
tchLast@QMYSQLResult@@MAE_NXZ) 中被引用
qsql_mysql.obj : error LNK2019: 无法解析的外部符号 _mysql_fetch_lengths@4,该符
号在函数 "protected: virtual class QVariant __thiscall QMYSQLResult::data(int)"
(?data@QMYSQLResult@@MAE?AVQVariant@@H@Z) 中被引用
qsql_mysql.obj : error LNK2019: 无法解析的外部符号 _mysql_fetch_field_direct@8,
该符号在函数 "protected: virtual bool __thiscall QMYSQLResult::reset(class QStri
ng const &)" (?reset@QMYSQLResult@@MAE_NABVQString@@@Z) 中被引用
qsql_mysql.obj : error LNK2019: 无法解析的外部符号 _mysql_affected_rows@4,该符
号在函数 "protected: virtual bool __thiscall QMYSQLResult::reset(class QString c
onst &)" (?reset@QMYSQLResult@@MAE_NABVQString@@@Z) 中被引用
qsql_mysql.obj : error LNK2019: 无法解析的外部符号 _mysql_field_count@4,该符号
在函数 "protected: virtual bool __thiscall QMYSQLResult::reset(class QString con
st &)" (?reset@QMYSQLResult@@MAE_NABVQString@@@Z) 中被引用
qsql_mysql.obj : error LNK2019: 无法解析的外部符号 _mysql_real_query@12,该符号
在函数 "protected: virtual bool __thiscall QMYSQLResult::reset(class QString con
st &)" (?reset@QMYSQLResult@@MAE_NABVQString@@@Z) 中被引用
qsql_mysql.obj : error LNK2019: 无法解析的外部符号 _mysql_errno@4,该符号在函数
"class QSqlError __cdecl qMakeError(class QString const &,enum QSqlError::ErrorT
ype,class QMYSQLDriverPrivate const *)" (?qMakeError@@YA?AVQSqlError@@ABVQString
@@W4ErrorType@1@PBVQMYSQLDriverPrivate@@@Z) 中被引用
qsql_mysql.obj : error LNK2019: 无法解析的外部符号 _mysql_error@4,该符号在函数
"class QSqlError __cdecl qMakeError(class QString const &,enum QSqlError::ErrorT
ype,class QMYSQLDriverPrivate const *)" (?qMakeError@@YA?AVQSqlError@@ABVQString
@@W4ErrorType@1@PBVQMYSQLDriverPrivate@@@Z) 中被引用
qsql_mysql.obj : error LNK2019: 无法解析的外部符号 _mysql_insert_id@4,该符号在
函数 "protected: virtual class QVariant __thiscall QMYSQLResult::lastInsertId(vo
id)const " (?lastInsertId@QMYSQLResult@@MBE?AVQVariant@@XZ) 中被引用
qsql_mysql.obj : error LNK2019: 无法解析的外部符号 _mysql_stmt_insert_id@4,该符
号在函数 "protected: virtual class QVariant __thiscall QMYSQLResult::lastInsertI
d(void)const " (?lastInsertId@QMYSQLResult@@MBE?AVQVariant@@XZ) 中被引用
qsql_mysql.obj : error LNK2019: 无法解析的外部符号 _mysql_field_seek@8,该符号在
函数 "protected: virtual class QSqlRecord __thiscall QMYSQLResult::record(void)c
onst " (?record@QMYSQLResult@@MBE?AVQSqlRecord@@XZ) 中被引用
qsql_mysql.obj : error LNK2019: 无法解析的外部符号 _mysql_stmt_param_count@4,该
符号在函数 "protected: virtual bool __thiscall QMYSQLResult::prepare(class QStri
ng const &)" (?prepare@QMYSQLResult@@MAE_NABVQString@@@Z) 中被引用
qsql_mysql.obj : error LNK2019: 无法解析的外部符号 _mysql_stmt_prepare@12,该符
号在函数 "protected: virtual bool __thiscall QMYSQLResult::prepare(class QString
const &)" (?prepare@QMYSQLResult@@MAE_NABVQString@@@Z) 中被引用
qsql_mysql.obj : error LNK2019: 无法解析的外部符号 _mysql_stmt_init@4,该符号在
函数 "protected: virtual bool __thiscall QMYSQLResult::prepare(class QString con
st &)" (?prepare@QMYSQLResult@@MAE_NABVQString@@@Z) 中被引用
qsql_mysql.obj : error LNK2019: 无法解析的外部符号 _mysql_stmt_store_result@4,
该符号在函数 "protected: virtual bool __thiscall QMYSQLResult::exec(void)" (?exe
c@QMYSQLResult@@MAE_NXZ) 中被引用
qsql_mysql.obj : error LNK2019: 无法解析的外部符号 _mysql_stmt_attr_set@12,该符
号在函数 "protected: virtual bool __thiscall QMYSQLResult::exec(void)" (?exec@QM
YSQLResult@@MAE_NXZ) 中被引用
qsql_mysql.obj : error LNK2019: 无法解析的外部符号 _mysql_stmt_bind_result@8,该
符号在函数 "protected: virtual bool __thiscall QMYSQLResult::exec(void)" (?exec@
QMYSQLResult@@MAE_NXZ) 中被引用
qsql_mysql.obj : error LNK2019: 无法解析的外部符号 _mysql_stmt_affected_rows@4,
该符号在函数 "protected: virtual bool __thiscall QMYSQLResult::exec(void)" (?exe
c@QMYSQLResult@@MAE_NXZ) 中被引用
qsql_mysql.obj : error LNK2019: 无法解析的外部符号 _mysql_stmt_execute@4,该符号
在函数 "protected: virtual bool __thiscall QMYSQLResult::exec(void)" (?exec@QMYS
QLResult@@MAE_NXZ) 中被引用
qsql_mysql.obj : error LNK2019: 无法解析的外部符号 _mysql_stmt_bind_param@8,该
符号在函数 "protected: virtual bool __thiscall QMYSQLResult::exec(void)" (?exec@
QMYSQLResult@@MAE_NXZ) 中被引用
qsql_mysql.obj : error LNK2019: 无法解析的外部符号 _mysql_stmt_reset@4,该符号在
函数 "protected: virtual bool __thiscall QMYSQLResult::exec(void)" (?exec@QMYSQL
Result@@MAE_NXZ) 中被引用
qsql_mysql.obj : error LNK2019: 无法解析的外部符号 _mysql_character_set_name@4,
该符号在函数 "class QTextCodec * __cdecl codec(struct st_mysql *)" (?codec@@YAPA
VQTextCodec@@PAUst_mysql@@@Z) 中被引用
qsql_mysql.obj : error LNK2019: 无法解析的外部符号 _mysql_thread_init@0,该符号
在函数 "public: virtual bool __thiscall QMYSQLDriver::open(class QString const &
,class QString const &,class QString const &,class QString const &,int,class QSt
ring const &)" (?open@QMYSQLDriver@@UAE_NABVQString@@000H0@Z) 中被引用
qsql_mysql.obj : error LNK2019: 无法解析的外部符号 _mysql_get_server_version@4,
该符号在函数 "public: virtual bool __thiscall QMYSQLDriver::open(class QString c
onst &,class QString const &,class QString const &,class QString const &,int,cla
ss QString const &)" (?open@QMYSQLDriver@@UAE_NABVQString@@000H0@Z) 中被引用
qsql_mysql.obj : error LNK2019: 无法解析的外部符号 _mysql_get_client_version@0,
该符号在函数 "public: virtual bool __thiscall QMYSQLDriver::open(class QString c
onst &,class QString const &,class QString const &,class QString const &,int,cla
ss QString const &)" (?open@QMYSQLDriver@@UAE_NABVQString@@000H0@Z) 中被引用
qsql_mysql.obj : error LNK2019: 无法解析的外部符号 _mysql_set_character_set@8,
该符号在函数 "public: virtual bool __thiscall QMYSQLDriver::open(class QString c
onst &,class QString const &,class QString const &,class QString const &,int,cla
ss QString const &)" (?open@QMYSQLDriver@@UAE_NABVQString@@000H0@Z) 中被引用
qsql_mysql.obj : error LNK2019: 无法解析的外部符号 _mysql_options@12,该符号在函
数 "public: virtual bool __thiscall QMYSQLDriver::open(class QString const &,cla
ss QString const &,class QString const &,class QString const &,int,class QString
const &)" (?open@QMYSQLDriver@@UAE_NABVQString@@000H0@Z) 中被引用
qsql_mysql.obj : error LNK2019: 无法解析的外部符号 _mysql_close@4,该符号在函数
"public: virtual bool __thiscall QMYSQLDriver::open(class QString const &,class
QString const &,class QString const &,class QString const &,int,class QString co
nst &)" (?open@QMYSQLDriver@@UAE_NABVQString@@000H0@Z) 中被引用
qsql_mysql.obj : error LNK2019: 无法解析的外部符号 _mysql_select_db@8,该符号在
函数 "public: virtual bool __thiscall QMYSQLDriver::open(class QString const &,c
lass QString const &,class QString const &,class QString const &,int,class QStri
ng const &)" (?open@QMYSQLDriver@@UAE_NABVQString@@000H0@Z) 中被引用
qsql_mysql.obj : error LNK2019: 无法解析的外部符号 _mysql_real_connect@32,该符
号在函数 "public: virtual bool __thiscall QMYSQLDriver::open(class QString const
&,class QString const &,class QString const &,class QString const &,int,class Q
String const &)" (?open@QMYSQLDriver@@UAE_NABVQString@@000H0@Z) 中被引用


debug\qsqlmysqld4.dll : fatal error LNK1120: 50 个无法解析的外部命令
NMAKE : fatal error U1077: “"C:\Program Files (x86)\Microsoft Visual Studio 9.0
\VC\BIN\link.EXE"”: 返回代码“0x460”
Stop.
NMAKE : fatal error U1077: “"C:\Program Files (x86)\Microsoft Visual Studio 9.0
\VC\BIN\nmake.exe"”: 返回代码“0x2”
Stop.


急求解决方法,谢谢!
...全文
682 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
天地一扁舟 2014-10-07
  • 打赏
  • 举报
回复
请问楼主朋友, 我也遇到同样的问题:出现的错误和你几乎一样。 我的配置是:win7 64位 +Qt5.0.1 + VS2010 + MySql5.6 64位非安装版,我始终编译不出MySql的驱动,还希望楼主朋友能指导一下我。 十分感谢
342902345 2013-09-03
  • 打赏
  • 举报
回复
请问是怎么解决的啊?
u_guanyu 2012-12-05
  • 打赏
  • 举报
回复
求教楼主,如何解决啊? 同样问题问扰中。。。。
ghosty_hand 2012-09-05
  • 打赏
  • 举报
回复
哎 找到问题了
1、系统问题 64位系统装的Mysql不匹配
2、系统路径中含有空格。
  • 打赏
  • 举报
回复
http://topic.csdn.net/u/20120801/16/a78de696-60e1-4e72-8fdb-a353e57d1012.html 这个是以前的帖子 我试验过 LZ看看
nj_wyj 2012-09-04
  • 打赏
  • 举报
回复
1、pro文件中原
LIBS+="D:\MySQL\Connector C 6.0.2\lib\opt\libmysql.lib"
改为
LIBS+=-L"D:\MySQL\Connector C 6.0.2\lib\opt" \
-lmysql

2、pro文件中增加
DEFINES += __LCC__

3、
文件D:\MySQL\Connector C 6.0.2\include\mysql.h中

#if !defined(__WIN__)
#define STDCALL
#else
#define STDCALL __stdcall
#endif

改为

#if !defined(__WIN__)
#define STDCALL
#else
#define STDCALL //__stdcall 去掉__stdcall
#endif
ghosty_hand 2012-09-04
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 的回复:]

LIBS+="D:\MySQL\Connector C 6.0.2\lib\opt\libmysql.lib"

改为
LIBS+=-L"D:\MySQL\Connector C 6.0.2\lib\opt" \
-lmysql

试一下
[/Quote]

不行,一样的错误
nj_wyj 2012-09-04
  • 打赏
  • 举报
回复
LIBS+="D:\MySQL\Connector C 6.0.2\lib\opt\libmysql.lib"

改为
LIBS+=-L"D:\MySQL\Connector C 6.0.2\lib\opt" \
-lmysql

试一下

16,212

社区成员

发帖
与我相关
我的任务
社区描述
Qt 是一个跨平台应用程序框架。通过使用 Qt,您可以一次性开发应用程序和用户界面,然后将其部署到多个桌面和嵌入式操作系统,而无需重复编写源代码。
社区管理员
  • Qt
  • 亭台六七座
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧