MariaDB社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 6212|回复: 5
打印 上一主题 下一主题

无法定位程序输入点mysql_set_character_set于动态连接库LIBMYSQL.dll上

[复制链接]
跳转到指定楼层
1#
发表于 2009-4-12 11:32:01 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
这是我在网上随便下的一段demo
#include <windows.h>
#include <process.h>
#include <iostream>
#include <string>
#include "mysql.h"   //安装的mysql的头文件所在的位置
using namespace std;
string host="localhost";
string user="root";
string pwd="";
string dbname="pure";
string sql="select * from cdn";
unsigned int port=3306;
int status;
int main(){
MYSQL *mysql;
mysql=mysql_init(0);
MYSQL_RES *result;
MYSQL_ROW row;
if(mysql_real_connect(mysql,host.c_str(),user.c_str(),pwd.c_str(),dbname.c_str(),port,NULL,CLIENT_FOUND_ROWS)==NULL){
  cout << "connect failure!" << endl;
  return EXIT_FAILURE;
}else{
  cout << "connect success!" << endl;
}
mysql_set_character_set(mysql,"gbk");
status=mysql_query(mysql,sql.c_str());
if(status !=0 ){
  cout << "query failure!" << endl;
}
cout << "the status is :" << status << endl;
result=mysql_store_result(mysql);
while(row=mysql_fetch_row(result)){
  cout << row[1] <<"|"<< row[2] << endl;
}
mysql_free_result(result);
mysql_close(mysql);
}

我安装的是mysql-essential-5.1.33-win32
开发环境是VS2008
库文件什么的都配置好了
编译通过
运行的时候就出现错误:无法定位程序输入点mysql_set_character_set于动态连接库LIBMYSQL.dll上
请大家帮帮忙
我是要准备做一个对MYSQL的C API的封装类,想先测试下,可是上述问题解决不了,测试不了........

PS:我是新手
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏1 转播转播 分享分享 分享淘帖 顶 踩
2#
发表于 2009-4-12 21:29:12 | 只看该作者
检查下环境变量

关注中...
3#
 楼主| 发表于 2009-4-13 20:18:53 | 只看该作者
没人知道是什么问题吗?
4#
 楼主| 发表于 2009-4-13 21:15:58 | 只看该作者
问题终于解决了,原来是我的LIBMYSQL.dll的版本不对,安装了MYSQL后,把在bin目录下的LIBMYSQL.dll复制到system32里就可以了..............
5#
发表于 2009-4-14 14:29:57 | 只看该作者
6#
发表于 2010-4-15 10:19:39 | 只看该作者
在 工程属性->链接器->输入中添加libmysql.lib , 估计可以解决你的问题,注意好运!因为你的工程不知道怎样去和libmysql.dll发生关联
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|手机版|MariaDB社区 ( 京ICP备07012489号    |
业务联系: QQ:48474881; 邮箱: 48474881@qq.com; 电话:13911732319
声明:本站部分文章是网友转载,若未经作者同意或署名有误,请联系网站管理员。

GMT+8, 2024-9-20 00:08 , Processed in 0.063432 second(s), 19 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表