如果还不解决,我的老板就会把吊起来熏着吃了。

applestudio 2003-05-27 04:30:58
在Linux下写了一个Oracle的C++编程接口,其内部使用OCI,现在说一下其结构:

object.h
object.cpp
定义Object,CRuntimeClass类,当然还有支持动态信息的几组宏
已经编译成object.o

databaseinterface.h
databaseinterface.cpp
定义CDi类
这是一个纯虚拟类,用来进行封装具体的数据库接口。
已经编译成databaseinterface.o

oci.h
oci.cpp
定义COci类
此类从CDi类派生,是一个具体类,它封装了OCI,是用户能方便的使用OCI类操做数据库。
已经编译成oci.o

result.h
result.cpp
定义CResult类
这是一个虚拟类,用来派生出具体的RESULT类。
已经编译成result.o

ociresult.h
ociresult.cpp
定义COciResult类
这个类为用COci来操作数据库的RESULT
已经编译成ociresult.o

oracle.h
oracle.cpp
定义COracle类
一个具体的数据库类
已经编译成oracle.o

demo.cpp
演示程序
SouceCode :
#include "oracle.h"
#include "oci.h"
#include "ociresult.h"

main()
{
int charge;
COci oci; //定义操作数据库接口
COciResult* rs; //数据集接口
COracle conn(&oci,RUNTIME_CLASS(COciResult)); // bind
conn.Connect("MM","MM");
rs=(COciResult*)conn.Execute("select * from acct_item where serv_id="+CONVER(93183));
rs->Fetch();
rs->GetValue("charge",&charge);
std::cout<<charge;
}

成功编译后
用g++ -o demo demo.o 来连接,出现如下错误,请大家帮忙,应该怎么连接,谢谢
demo.o: In function `COci::~COci(void)':
demo.o(.text+0xc3f): undefined reference to `COci virtual table'
demo.o(.text+0xd51): undefined reference to `CDi::~CDi(void)'
demo.o: In function `COracle::COracle(CDi *, CRuntimeClass *)':
demo.o(.text+0x2097): undefined reference to `CObject::CObject(void)'
demo.o: In function `COci::COci(void)':
demo.o(.COci::gnu.linkonce.t.(void)+0x19): undefined reference to `COci virtual
table'
demo.o(.COci::gnu.linkonce.t.(void)+0x102): undefined reference to `CDi::~CDi(vo
id)'
demo.o: In function `CResult type_info function':
demo.o(.gnu.linkonce.t.__tf7CResult+0x10): undefined reference to `CObject type_
info function'
demo.o(.gnu.linkonce.t.__tf7CResult+0x18): undefined reference to `CObject type_
info node'
demo.o: In function `COracle::~COracle(void)':
demo.o(.gnu.linkonce.t._._7COracle+0x1c): undefined reference to `CObject::~CObj
ect(void)'
demo.o: In function `COracle type_info function':
demo.o(.gnu.linkonce.t.__tf7COracle+0x10): undefined reference to `CObject type_
info function'
demo.o(.gnu.linkonce.t.__tf7COracle+0x18): undefined reference to `CObject type_
info node'
demo.o: In function `CDi::CDi(void)':
demo.o(.CDi::gnu.linkonce.t.(void)+0xf): undefined reference to `CObject::CObjec
t(void)'
demo.o(.CDi::gnu.linkonce.t.(void)+0x18): undefined reference to `CDi virtual ta
ble'
demo.o: In function `CResult::~CResult(void)':
demo.o(.gnu.linkonce.t._._7CResult+0x1c): undefined reference to `CObject::~CObj
ect(void)'
demo.o: In function `CResult::CResult(void)':
demo.o(.CResult::gnu.linkonce.t.(void)+0xf): undefined reference to `CObject::CO
bject(void)'
collect2: ld returned 1 exit status

...全文
43 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
zxyin1 2003-05-28
  • 打赏
  • 举报
回复
同情中
程序的色彩 2003-05-27
  • 打赏
  • 举报
回复
gz
AthlonxpX86 2003-05-27
  • 打赏
  • 举报
回复

Linux下写了一个Oracle。。。。。。。。没做过,但是你的程序中CObject是什么啊怎么看的像是VC中MFC的基类,VC的代码应该是只能用在windows上的,是不是windows版本的代码?

zhaoweidf 2003-05-27
  • 打赏
  • 举报
回复
学习
dnvihc 2003-05-27
  • 打赏
  • 举报
回复
唉,无能为力!
UPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP!
wanghero 2003-05-27
  • 打赏
  • 举报
回复
看不懂,帮你up
FAICHEN 2003-05-27
  • 打赏
  • 举报
回复
记得别洗澡阿!这样没准就放过你了!
tigercant 2003-05-27
  • 打赏
  • 举报
回复
up
sharpblade 2003-05-27
  • 打赏
  • 举报
回复
oracle看不懂,帮你up
fogsea 2003-05-27
  • 打赏
  • 举报
回复
帮你up
思危 2003-05-27
  • 打赏
  • 举报
回复
只能帮你UP了
onlyforme 2003-05-27
  • 打赏
  • 举报
回复
无能为力!
帮你UP

16,473

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

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