当前时区为 UTC + 8 小时



发表新帖 回复这个主题  [ 4 篇帖子 ] 
作者 内容
1 楼 
 文章标题 : 怎样使用otl调用mysql数据库?编译otl自带的例子出错
帖子发表于 : 2009-09-11 23:21 

注册: 2009-09-11 15:16
帖子: 2
送出感谢: 0 次
接收感谢: 0 次
我在ubuntu上用otl调用mysql数据库,我编译otl的例子:结果出现如下错误:
g++ -Wall -c ex82_odbc.cpp -I. -I/usr/include -I/usr/include/mysql -I/usr/include/mysql++ -o ex82_odbc.o
g++ ex82_odbc.o -o haha -L/lib -L/usr/lib -L/usr/lib/odbc -L/usr/lib/mysql
ex82_odbc.o: In function `otl_conn::logoff()':
ex82_odbc.cpp:(.text._ZN8otl_conn6logoffEv[otl_conn::logoff()]+0x4a): undefined reference to `SQLDisconnect'
ex82_odbc.o: In function `otl_conn::error(otl_exc&)':
ex82_odbc.cpp:(.text._ZN8otl_conn5errorER7otl_exc[otl_conn::error(otl_exc&)]+0x60): undefined reference to `SQLGetDiagRec'
ex82_odbc.o: In function `otl_cur::error(otl_exc&)':
ex82_odbc.cpp:(.text._ZN7otl_cur5errorER7otl_exc[otl_cur::error(otl_exc&)]+0x60): undefined reference to `SQLGetDiagRec'
ex82_odbc.o: In function `otl_conn::~otl_conn()':
ex82_odbc.cpp:(.text._ZN8otl_connD1Ev[otl_conn::~otl_conn()]+0x53): undefined reference to `SQLFreeHandle'
ex82_odbc.cpp:(.text._ZN8otl_connD1Ev[otl_conn::~otl_conn()]+0x86): undefined reference to `SQLFreeHandle'
ex82_odbc.o: In function `otl_conn::~otl_conn()':
ex82_odbc.cpp:(.text._ZN8otl_connD0Ev[otl_conn::~otl_conn()]+0x53): undefined reference to `SQLFreeHandle'
ex82_odbc.cpp:(.text._ZN8otl_connD0Ev[otl_conn::~otl_conn()]+0x86): undefined reference to `SQLFreeHandle'
ex82_odbc.o: In function `otl_cur::close()':
ex82_odbc.cpp:(.text._ZN7otl_cur5closeEv[otl_cur::close()]+0x22): undefined reference to `SQLFreeHandle'
ex82_odbc.o: In function `otl_conn::rlogon(char const*, int)':
ex82_odbc.cpp:(.text._ZN8otl_conn6rlogonEPKci[otl_conn::rlogon(char const*, int)]+0x569): undefined reference to `SQLAllocHandle'
ex82_odbc.cpp:(.text._ZN8otl_conn6rlogonEPKci[otl_conn::rlogon(char const*, int)]+0x5c8): undefined reference to `SQLSetEnvAttr'
ex82_odbc.cpp:(.text._ZN8otl_conn6rlogonEPKci[otl_conn::rlogon(char const*, int)]+0x624): undefined reference to `SQLAllocHandle'
ex82_odbc.cpp:(.text._ZN8otl_conn6rlogonEPKci[otl_conn::rlogon(char const*, int)]+0x6a4): undefined reference to `SQLSetConnectAttr'
ex82_odbc.cpp:(.text._ZN8otl_conn6rlogonEPKci[otl_conn::rlogon(char const*, int)]+0x72a): undefined reference to `SQLConnect'
ex82_odbc.cpp:(.text._ZN8otl_conn6rlogonEPKci[otl_conn::rlogon(char const*, int)]+0x83b): undefined reference to `SQLDriverConnect'
ex82_odbc.o: In function `otl_cur::bind(int, otl_var&, int, int, int)':
ex82_odbc.cpp:(.text._ZN7otl_cur4bindEiR7otl_variii[otl_cur::bind(int, otl_var&, int, int, int)]+0xc1): undefined reference to `SQLBindCol'
ex82_odbc.o: In function `otl_cur::bind(char const*, otl_var&, int, int, int, int, int, int)':
ex82_odbc.cpp:(.text._ZN7otl_cur4bindEPKcR7otl_variiiiii[otl_cur::bind(char const*, otl_var&, int, int, int, int, int, int)]+0x162): undefined reference to `SQLBindParameter'
ex82_odbc.cpp:(.text._ZN7otl_cur4bindEPKcR7otl_variiiiii[otl_cur::bind(char const*, otl_var&, int, int, int, int, int, int)]+0x219): undefined reference to `SQLBindParameter'
ex82_odbc.o: In function `otl_cur::open(otl_conn&)':
ex82_odbc.cpp:(.text._ZN7otl_cur4openER8otl_conn[otl_cur::open(otl_conn&)]+0x3f): undefined reference to `SQLAllocHandle'
ex82_odbc.cpp:(.text._ZN7otl_cur4openER8otl_conn[otl_cur::open(otl_conn&)]+0x9d): undefined reference to `SQLSetStmtAttr'
ex82_odbc.cpp:(.text._ZN7otl_cur4openER8otl_conn[otl_cur::open(otl_conn&)]+0xf8): undefined reference to `SQLSetStmtAttr'
ex82_odbc.o: In function `otl_cur::sql_row_count(long*)':
ex82_odbc.cpp:(.text._ZN7otl_cur13sql_row_countEPl[otl_cur::sql_row_count(long*)]+0x17): undefined reference to `SQLRowCount'
ex82_odbc.o: In function `otl_cur::parse(char*)':
ex82_odbc.cpp:(.text._ZN7otl_cur5parseEPc[otl_cur::parse(char*)]+0x4c5): undefined reference to `SQLTables'
ex82_odbc.cpp:(.text._ZN7otl_cur5parseEPc[otl_cur::parse(char*)]+0x510): undefined reference to `SQLGetTypeInfo'
ex82_odbc.cpp:(.text._ZN7otl_cur5parseEPc[otl_cur::parse(char*)]+0x5d9): undefined reference to `SQLColumns'
ex82_odbc.cpp:(.text._ZN7otl_cur5parseEPc[otl_cur::parse(char*)]+0x670): undefined reference to `SQLProcedures'
ex82_odbc.cpp:(.text._ZN7otl_cur5parseEPc[otl_cur::parse(char*)]+0x739): undefined reference to `SQLColumnPrivileges'
ex82_odbc.cpp:(.text._ZN7otl_cur5parseEPc[otl_cur::parse(char*)]+0x7d0): undefined reference to `SQLTablePrivileges'
ex82_odbc.cpp:(.text._ZN7otl_cur5parseEPc[otl_cur::parse(char*)]+0x867): undefined reference to `SQLPrimaryKeys'
ex82_odbc.cpp:(.text._ZN7otl_cur5parseEPc[otl_cur::parse(char*)]+0x930): undefined reference to `SQLProcedureColumns'
ex82_odbc.cpp:(.text._ZN7otl_cur5parseEPc[otl_cur::parse(char*)]+0xa55): undefined reference to `SQLForeignKeys'
ex82_odbc.cpp:(.text._ZN7otl_cur5parseEPc[otl_cur::parse(char*)]+0xaff): undefined reference to `SQLExecDirect'
ex82_odbc.cpp:(.text._ZN7otl_cur5parseEPc[otl_cur::parse(char*)]+0xd98): undefined reference to `SQLPrepare'
ex82_odbc.o: In function `otl_cur::exec(int, int, int)':
ex82_odbc.cpp:(.text._ZN7otl_cur4execEiii[otl_cur::exec(int, int, int)]+0x4e): undefined reference to `SQLExecute'
ex82_odbc.o: In function `otl_sel::close_select(otl_cur&)':
ex82_odbc.cpp:(.text._ZN7otl_sel12close_selectER7otl_cur[otl_sel::close_select(otl_cur&)]+0x2b): undefined reference to `SQLFreeStmt'
ex82_odbc.o: In function `otl_cur::describe_column(otl_column_desc&, int, int&)':
ex82_odbc.cpp:(.text._ZN7otl_cur15describe_columnER15otl_column_desciRi[otl_cur::describe_column(otl_column_desc&, int, int&)]+0x52): undefined reference to `SQLNumResultCols'
ex82_odbc.cpp:(.text._ZN7otl_cur15describe_columnER15otl_column_desciRi[otl_cur::describe_column(otl_column_desc&, int, int&)]+0x10f): undefined reference to `SQLDescribeCol'
ex82_odbc.o: In function `otl_sel::first(otl_cur&, int&, int&, int&, int&, int)':
ex82_odbc.cpp:(.text._ZN7otl_sel5firstER7otl_curRiS2_S2_S2_i[otl_sel::first(otl_cur&, int&, int&, int&, int&, int)]+0x39): undefined reference to `SQLSetStmtAttr'
ex82_odbc.cpp:(.text._ZN7otl_sel5firstER7otl_curRiS2_S2_S2_i[otl_sel::first(otl_cur&, int&, int&, int&, int&, int)]+0xa2): undefined reference to `SQLSetStmtAttr'
ex82_odbc.cpp:(.text._ZN7otl_sel5firstER7otl_curRiS2_S2_S2_i[otl_sel::first(otl_cur&, int&, int&, int&, int&, int)]+0xfb): undefined reference to `SQLExecute'
ex82_odbc.cpp:(.text._ZN7otl_sel5firstER7otl_curRiS2_S2_S2_i[otl_sel::first(otl_cur&, int&, int&, int&, int&, int)]+0x15a): undefined reference to `SQLFetchScroll'
ex82_odbc.cpp:(.text._ZN7otl_sel5firstER7otl_curRiS2_S2_S2_i[otl_sel::first(otl_cur&, int&, int&, int&, int&, int)]+0x1f5): undefined reference to `SQLFreeStmt'
ex82_odbc.o: In function `otl_sel::next(otl_cur&, int&, int&, int&, int&, int)':
ex82_odbc.cpp:(.text._ZN7otl_sel4nextER7otl_curRiS2_S2_S2_i[otl_sel::next(otl_cur&, int&, int&, int&, int&, int)]+0x67): undefined reference to `SQLFreeStmt'
ex82_odbc.cpp:(.text._ZN7otl_sel4nextER7otl_curRiS2_S2_S2_i[otl_sel::next(otl_cur&, int&, int&, int&, int&, int)]+0xb1): undefined reference to `SQLFetchScroll'
ex82_odbc.cpp:(.text._ZN7otl_sel4nextER7otl_curRiS2_S2_S2_i[otl_sel::next(otl_cur&, int&, int&, int&, int&, int)]+0x143): undefined reference to `SQLFreeStmt'
collect2: ld returned 1 exit status
make: *** [haha] Error 1


请问错误出错原因是什么?如何解决?多谢。


页首
 用户资料  
 
2 楼 
 文章标题 : Re: 怎样使用otl调用mysql数据库?编译otl自带的例子出错
帖子发表于 : 2009-09-12 22:03 

注册: 2009-09-11 15:16
帖子: 2
送出感谢: 0 次
接收感谢: 0 次
请大家帮忙


页首
 用户资料  
 
3 楼 
 文章标题 : Re: 怎样使用otl调用mysql数据库?编译otl自带的例子出错
帖子发表于 : 2009-09-15 22:52 
头像

注册: 2008-02-24 14:15
帖子: 693
地址: 江苏
系统: Ubuntu
送出感谢: 17
接收感谢: 0 次
russule 写道:
我在ubuntu上用otl调用mysql数据库,我编译otl的例子:结果出现如下错误:
g++ -Wall -c ex82_odbc.cpp -I. -I/usr/include -I/usr/include/mysql -I/usr/include/mysql++ -o ex82_odbc.o
g++ ex82_odbc.o -o haha -L/lib -L/usr/lib -L/usr/lib/odbc -L/usr/lib/mysql
ex82_odbc.o: In function `otl_conn::logoff()':
ex82_odbc.cpp:(.text._ZN8otl_conn6logoffEv[otl_conn::logoff()]+0x4a): undefined reference to `SQLDisconnect'
ex82_odbc.o: In function `otl_conn::error(otl_exc&)':
ex82_odbc.cpp:(.text._ZN8otl_conn5errorER7otl_exc[otl_conn::error(otl_exc&)]+0x60): undefined reference to `SQLGetDiagRec'
ex82_odbc.o: In function `otl_cur::error(otl_exc&)':
ex82_odbc.cpp:(.text._ZN7otl_cur5errorER7otl_exc[otl_cur::error(otl_exc&)]+0x60): undefined reference to `SQLGetDiagRec'
ex82_odbc.o: In function `otl_conn::~otl_conn()':
ex82_odbc.cpp:(.text._ZN8otl_connD1Ev[otl_conn::~otl_conn()]+0x53): undefined reference to `SQLFreeHandle'
ex82_odbc.cpp:(.text._ZN8otl_connD1Ev[otl_conn::~otl_conn()]+0x86): undefined reference to `SQLFreeHandle'
ex82_odbc.o: In function `otl_conn::~otl_conn()':
ex82_odbc.cpp:(.text._ZN8otl_connD0Ev[otl_conn::~otl_conn()]+0x53): undefined reference to `SQLFreeHandle'
ex82_odbc.cpp:(.text._ZN8otl_connD0Ev[otl_conn::~otl_conn()]+0x86): undefined reference to `SQLFreeHandle'
ex82_odbc.o: In function `otl_cur::close()':
ex82_odbc.cpp:(.text._ZN7otl_cur5closeEv[otl_cur::close()]+0x22): undefined reference to `SQLFreeHandle'
ex82_odbc.o: In function `otl_conn::rlogon(char const*, int)':
ex82_odbc.cpp:(.text._ZN8otl_conn6rlogonEPKci[otl_conn::rlogon(char const*, int)]+0x569): undefined reference to `SQLAllocHandle'
ex82_odbc.cpp:(.text._ZN8otl_conn6rlogonEPKci[otl_conn::rlogon(char const*, int)]+0x5c8): undefined reference to `SQLSetEnvAttr'
ex82_odbc.cpp:(.text._ZN8otl_conn6rlogonEPKci[otl_conn::rlogon(char const*, int)]+0x624): undefined reference to `SQLAllocHandle'
ex82_odbc.cpp:(.text._ZN8otl_conn6rlogonEPKci[otl_conn::rlogon(char const*, int)]+0x6a4): undefined reference to `SQLSetConnectAttr'
ex82_odbc.cpp:(.text._ZN8otl_conn6rlogonEPKci[otl_conn::rlogon(char const*, int)]+0x72a): undefined reference to `SQLConnect'
ex82_odbc.cpp:(.text._ZN8otl_conn6rlogonEPKci[otl_conn::rlogon(char const*, int)]+0x83b): undefined reference to `SQLDriverConnect'
ex82_odbc.o: In function `otl_cur::bind(int, otl_var&, int, int, int)':
ex82_odbc.cpp:(.text._ZN7otl_cur4bindEiR7otl_variii[otl_cur::bind(int, otl_var&, int, int, int)]+0xc1): undefined reference to `SQLBindCol'
ex82_odbc.o: In function `otl_cur::bind(char const*, otl_var&, int, int, int, int, int, int)':
ex82_odbc.cpp:(.text._ZN7otl_cur4bindEPKcR7otl_variiiiii[otl_cur::bind(char const*, otl_var&, int, int, int, int, int, int)]+0x162): undefined reference to `SQLBindParameter'
ex82_odbc.cpp:(.text._ZN7otl_cur4bindEPKcR7otl_variiiiii[otl_cur::bind(char const*, otl_var&, int, int, int, int, int, int)]+0x219): undefined reference to `SQLBindParameter'
ex82_odbc.o: In function `otl_cur::open(otl_conn&)':
ex82_odbc.cpp:(.text._ZN7otl_cur4openER8otl_conn[otl_cur::open(otl_conn&)]+0x3f): undefined reference to `SQLAllocHandle'
ex82_odbc.cpp:(.text._ZN7otl_cur4openER8otl_conn[otl_cur::open(otl_conn&)]+0x9d): undefined reference to `SQLSetStmtAttr'
ex82_odbc.cpp:(.text._ZN7otl_cur4openER8otl_conn[otl_cur::open(otl_conn&)]+0xf8): undefined reference to `SQLSetStmtAttr'
ex82_odbc.o: In function `otl_cur::sql_row_count(long*)':
ex82_odbc.cpp:(.text._ZN7otl_cur13sql_row_countEPl[otl_cur::sql_row_count(long*)]+0x17): undefined reference to `SQLRowCount'
ex82_odbc.o: In function `otl_cur::parse(char*)':
ex82_odbc.cpp:(.text._ZN7otl_cur5parseEPc[otl_cur::parse(char*)]+0x4c5): undefined reference to `SQLTables'
ex82_odbc.cpp:(.text._ZN7otl_cur5parseEPc[otl_cur::parse(char*)]+0x510): undefined reference to `SQLGetTypeInfo'
ex82_odbc.cpp:(.text._ZN7otl_cur5parseEPc[otl_cur::parse(char*)]+0x5d9): undefined reference to `SQLColumns'
ex82_odbc.cpp:(.text._ZN7otl_cur5parseEPc[otl_cur::parse(char*)]+0x670): undefined reference to `SQLProcedures'
ex82_odbc.cpp:(.text._ZN7otl_cur5parseEPc[otl_cur::parse(char*)]+0x739): undefined reference to `SQLColumnPrivileges'
ex82_odbc.cpp:(.text._ZN7otl_cur5parseEPc[otl_cur::parse(char*)]+0x7d0): undefined reference to `SQLTablePrivileges'
ex82_odbc.cpp:(.text._ZN7otl_cur5parseEPc[otl_cur::parse(char*)]+0x867): undefined reference to `SQLPrimaryKeys'
ex82_odbc.cpp:(.text._ZN7otl_cur5parseEPc[otl_cur::parse(char*)]+0x930): undefined reference to `SQLProcedureColumns'
ex82_odbc.cpp:(.text._ZN7otl_cur5parseEPc[otl_cur::parse(char*)]+0xa55): undefined reference to `SQLForeignKeys'
ex82_odbc.cpp:(.text._ZN7otl_cur5parseEPc[otl_cur::parse(char*)]+0xaff): undefined reference to `SQLExecDirect'
ex82_odbc.cpp:(.text._ZN7otl_cur5parseEPc[otl_cur::parse(char*)]+0xd98): undefined reference to `SQLPrepare'
ex82_odbc.o: In function `otl_cur::exec(int, int, int)':
ex82_odbc.cpp:(.text._ZN7otl_cur4execEiii[otl_cur::exec(int, int, int)]+0x4e): undefined reference to `SQLExecute'
ex82_odbc.o: In function `otl_sel::close_select(otl_cur&)':
ex82_odbc.cpp:(.text._ZN7otl_sel12close_selectER7otl_cur[otl_sel::close_select(otl_cur&)]+0x2b): undefined reference to `SQLFreeStmt'
ex82_odbc.o: In function `otl_cur::describe_column(otl_column_desc&, int, int&)':
ex82_odbc.cpp:(.text._ZN7otl_cur15describe_columnER15otl_column_desciRi[otl_cur::describe_column(otl_column_desc&, int, int&)]+0x52): undefined reference to `SQLNumResultCols'
ex82_odbc.cpp:(.text._ZN7otl_cur15describe_columnER15otl_column_desciRi[otl_cur::describe_column(otl_column_desc&, int, int&)]+0x10f): undefined reference to `SQLDescribeCol'
ex82_odbc.o: In function `otl_sel::first(otl_cur&, int&, int&, int&, int&, int)':
ex82_odbc.cpp:(.text._ZN7otl_sel5firstER7otl_curRiS2_S2_S2_i[otl_sel::first(otl_cur&, int&, int&, int&, int&, int)]+0x39): undefined reference to `SQLSetStmtAttr'
ex82_odbc.cpp:(.text._ZN7otl_sel5firstER7otl_curRiS2_S2_S2_i[otl_sel::first(otl_cur&, int&, int&, int&, int&, int)]+0xa2): undefined reference to `SQLSetStmtAttr'
ex82_odbc.cpp:(.text._ZN7otl_sel5firstER7otl_curRiS2_S2_S2_i[otl_sel::first(otl_cur&, int&, int&, int&, int&, int)]+0xfb): undefined reference to `SQLExecute'
ex82_odbc.cpp:(.text._ZN7otl_sel5firstER7otl_curRiS2_S2_S2_i[otl_sel::first(otl_cur&, int&, int&, int&, int&, int)]+0x15a): undefined reference to `SQLFetchScroll'
ex82_odbc.cpp:(.text._ZN7otl_sel5firstER7otl_curRiS2_S2_S2_i[otl_sel::first(otl_cur&, int&, int&, int&, int&, int)]+0x1f5): undefined reference to `SQLFreeStmt'
ex82_odbc.o: In function `otl_sel::next(otl_cur&, int&, int&, int&, int&, int)':
ex82_odbc.cpp:(.text._ZN7otl_sel4nextER7otl_curRiS2_S2_S2_i[otl_sel::next(otl_cur&, int&, int&, int&, int&, int)]+0x67): undefined reference to `SQLFreeStmt'
ex82_odbc.cpp:(.text._ZN7otl_sel4nextER7otl_curRiS2_S2_S2_i[otl_sel::next(otl_cur&, int&, int&, int&, int&, int)]+0xb1): undefined reference to `SQLFetchScroll'
ex82_odbc.cpp:(.text._ZN7otl_sel4nextER7otl_curRiS2_S2_S2_i[otl_sel::next(otl_cur&, int&, int&, int&, int&, int)]+0x143): undefined reference to `SQLFreeStmt'
collect2: ld returned 1 exit status
make: *** [haha] Error 1


请问错误出错原因是什么?如何解决?多谢。

这个真不清楚
重装行吗?


_________________

怀念以前的老台式机。可惜现在租的地方没条件用了。目前只能用笔记本和手机了。


页首
 用户资料  
 
4 楼 
 文章标题 : Re: 怎样使用otl调用mysql数据库?编译otl自带的例子出错
帖子发表于 : 2009-09-27 11:23 

注册: 2009-09-27 11:21
帖子: 1
送出感谢: 0 次
接收感谢: 0 次
好像是要安装unixodbc吧 之前碰到过 具体的忘了 呵呵


页首
 用户资料  
 
显示帖子 :  排序  
发表新帖 回复这个主题  [ 4 篇帖子 ] 

当前时区为 UTC + 8 小时


在线用户

正在浏览此版面的用户:没有注册用户 和 3 位游客


不能 在这个版面发表主题
不能 在这个版面回复主题
不能 在这个版面编辑帖子
不能 在这个版面删除帖子
不能 在这个版面提交附件

前往 :  
本站点为公益性站点,用于推广开源自由软件,由 DiaHosting VPSBudgetVM VPS 提供服务。
我们认为:软件应可免费取得,软件工具在各种语言环境下皆可使用,且不会有任何功能上的差异;
人们应有定制和修改软件的自由,且方式不受限制,只要他们自认为合适。

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
简体中文语系由 王笑宇 翻译