occi编译,连接问题

zjgUYPA 2010-01-25 02:47:26
我的gcc为 3.4.6版本的 。oracle数据库为 oracle10.2.0.4 版的
我下载了
oracle-instantclient-devel-10.2.0.4-1.i386.zip
oracle-instantclient-basic-10.2.0.4-1.i386.zip
解压到:
/home/zjg/oracle_occi/instantclient_10_2目下
/home/zjg/oracle_occi/instantclient_10_2目录下的内容为:
-rwxrwxrwx 1 root zjg 238 Feb 17 2008 BASIC_README
-rwxrwxrwx 1 root zjg 1609607 Feb 17 2008 classes12.jar
-rwxrwxrwx 1 root zjg 67766 Feb 17 2008 genezi
-rwxrwxrwx 1 root zjg 1525 Feb 17 2008 glogin.sql
lrwxrwxrwx 1 root root 17 Jan 25 12:25 libclntsh.so -> libclntsh.so.10.1
-rwxrwxrwx 1 root zjg 19076649 Feb 17 2008 libclntsh.so.10.1
-rwxrwxrwx 1 root zjg 5656445 Feb 17 2008 libnnz10.so
lrwxrwxrwx 1 root root 15 Jan 25 12:24 libocci.so -> libocci.so.10.1
-rwxrwxrwx 1 root zjg 1398244 Feb 17 2008 libocci.so.10.1
-rwxrwxrwx 1 root zjg 72698427 Feb 17 2008 libociei.so
-rwxrwxrwx 1 root zjg 120443 Feb 17 2008 libocijdbc10.so
-rwxrwxrwx 1 root zjg 1434263 Feb 17 2008 libsqlplusic.so
-rwxrwxrwx 1 root zjg 1069221 Feb 17 2008 libsqlplus.so
-rwxrwxrwx 1 root zjg 1555682 Feb 17 2008 ojdbc14.jar
drwxrwxr-x 4 root root 4096 Feb 17 2008 sdk
-rwxrwxrwx 1 root zjg 8903 Feb 17 2008 sqlplus
-rwxrwxrwx 1 root zjg 242 Feb 17 2008 SQLPLUS_README

/home/zjg/oracle_occi/instantclient_10_2/sdk目录下的内容为
drwxrwxr-x 2 root root 4096 Jan 25 12:17 demo
drwxrwxr-x 2 root root 4096 Feb 17 2008 include
-rwxrwxr-x 1 root root 738 Feb 17 2008 ott
-rw-rw-r-- 1 root root 298277 Feb 17 2008 ottclasses.zip
-rw-rw-r-- 1 root root 234 Feb 17 2008 SDK_README

/home/zjg/oracle_occi/instantclient_10_2/sdk/include目录下的内容为
-r--r--r-- 1 root root 33230 Feb 17 2008 nzerror.h
-r--r--r-- 1 root root 85310 Feb 17 2008 nzt.h
-r--r--r-- 1 root root 11600 Feb 17 2008 occiAQ.h
-r--r--r-- 1 root root 38724 Feb 17 2008 occiCommon.h
-r--r--r-- 1 root root 73063 Feb 17 2008 occiControl.h
-r--r--r-- 1 root root 35218 Feb 17 2008 occiData.h
-r--r--r-- 1 root root 2115 Feb 17 2008 occi.h
-r--r--r-- 1 root root 29307 Feb 17 2008 occiObjects.h
-r-xr-xr-x 1 root root 7155 Feb 17 2008 oci1.h
-r--r--r-- 1 root root 10361 Feb 17 2008 oci8dp.h
-r--r--r-- 1 root root 411221 Feb 17 2008 ociap.h
-r-xr-xr-x 1 root root 6055 Feb 17 2008 ociapr.h
-r--r--r-- 1 root root 43225 Feb 17 2008 ocidef.h
-r-xr-xr-x 1 root root 4014 Feb 17 2008 ocidem.h
-r--r--r-- 1 root root 11331 Feb 17 2008 ocidfn.h
-r--r--r-- 1 root root 8954 Feb 17 2008 ociextp.h
-r--r--r-- 1 root root 152599 Feb 17 2008 oci.h
-r-xr-xr-x 1 root root 6638 Feb 17 2008 ocikpr.h
-r--r--r-- 1 root root 4351 Feb 17 2008 ocixmldb.h
-r--r--r-- 1 root root 19099 Feb 17 2008 odci.h
-r-xr-xr-x 1 root root 6605 Feb 17 2008 oratypes.h
-r--r--r-- 1 root root 15031 Feb 17 2008 orid.h
-r--r--r-- 1 root root 102726 Feb 17 2008 ori.h
-r--r--r-- 1 root root 157674 Feb 17 2008 orl.h
-r--r--r-- 1 root root 42626 Feb 17 2008 oro.h
-r--r--r-- 1 root root 116591 Feb 17 2008 ort.h
-r-xr-xr-x 1 root root 9520 Feb 17 2008 xa.h

我把/home/zjg/oracle_occi/instantclient_10_2/sdk/include目录映射到了
/usr/local/include/occi 上,
命令用的是:
cd /usr/local/include
ln -s /home/zjg/oracle_occi/instantclient_10_2/sdk/include occi


写一个类,测试
/*
* COcciDb.h
*
* Created on: 2009-12-29
* Author: zhangjg
*/

#ifndef COCCIDB_H_
#define COCCIDB_H_
#include <string>
#include <iostream>
#include <occi/occi.h>
#include <occi/occiCommon.h>
#include <occi/occiData.h>
#include <occi/occiObjects.h>
#include <occi/occiAQ.h>
#include <occi/occiControl.h>
using namespace oracle::occi;
using namespace std;
namespace gateway {
class COcciDb {
public:
COcciDb();
COcciDb(string usr, string passwd, string db);
virtual ~COcciDb();
static COcciDb* getInstance(string usr, string passwd, string db);
int getConnectCount(){ return _Instance->count; };
Connection* getConnect(){ count++;return _Instance->conn; };
private:
static COcciDb* _Instance;
static int count;
Environment *env;
Connection *conn;
};

}
#endif /* COCCIDB_H_ */

.......................

编译参数添加了 -L /home/zjg/oracle_occi/instantclient_10_2 -locci -lclntsh

然后在linux上编译,报下面这样的错,

/usr/local/include/occi/occiAQ.h:286: error: `OCI_SUBSCR_PROTO_HTTP' was not declared in this scope
/usr/local/include/occi/occiAQ.h:286: error: enumerator value for `PROTO_HTTP' not integer constant
/usr/local/include/occi/occiAQ.h:289: error: `OCI_SUBSCR_NAMESPACE_ANONYMOUS' was not declared in this scope
/usr/local/include/occi/occiAQ.h:289: error: enumerator value for `NS_ANONYMOUS' not integer constant
/usr/local/include/occi/occiAQ.h:291: error: `OCI_SUBSCR_NAMESPACE_AQ' was not declared in this scope
/usr/local/include/occi/occiAQ.h:291: error: enumerator value for `NS_AQ' not integer constant
/usr/local/include/occi/occiAQ.h:294: error: `OCISubscription' has not been declared
/usr/local/include/occi/occiAQ.h:322: error: expected `;' before '*' token
/usr/local/include/occi/occiAQ.h:344: error: expected `;' before '*' token
/usr/local/include/occi/occiAQ.h:345: error: `ub4' does not name a type
/usr/local/include/occi/occiAQ.h:349: error: `ub4' has not been declared
/usr/local/include/occi/occiAQ.h:350: error: `ub4' has not been declared
In file included from ../src/comm/oracle/COcciAccessor.h:17,
from ../src/comm/oracle/COcciAccessor.cpp:8:
/usr/local/include/occi/occiControl.h:183: error: `OCI_ATTR_PTYPE' was not declared in this scope
/usr/local/include/occi/occiControl.h:183: error: enumerator value for `ATTR_PTYPE' not integer constant
/usr/local/include/occi/occiControl.h:184: error: `OCI_ATTR_TIMESTAMP' was not declared in this scope
/usr/local/include/occi/occiControl.h:184: error: enumerator value for `ATTR_TIMESTAMP' not integer constant
/usr/local/include/occi/occiControl.h:185: error: `OCI_ATTR_OBJ_ID' was not declared in this scope
/usr/local/include/occi/occiControl.h:185: error: enumerator value for `ATTR_OBJ_ID' not integer constant
/usr/local/include/occi/occiControl.h:186: error: `OCI_ATTR_OBJ_NAME' was not declared in this scope
/usr/local/include/occi/occiControl.h:186: error: enumerator value for `ATTR_OBJ_NAME' not integer constant
/usr/local/include/occi/occiControl.h:187: error: `OCI_ATTR_OBJ_SCHEMA' was not declared in this scope
/usr/local/include/occi/occiControl.h:187: error: enumerator value for `ATTR_OBJ_SCHEMA' not integer constant
/usr/local/include/occi/occiControl.h:188: error: `OCI_ATTR_OBJID' was not declared in this scope
/usr/local/include/occi/occiControl.h:188: error: enumerator value for `ATTR_OBJID' not integer constant
/usr/local/include/occi/occiControl.h:189: error: `OCI_ATTR_NUM_COLS' was not declared in this scope
/usr/local/include/occi/occiControl.h:189: error: enumerator value for `ATTR_NUM_COLS' not integer constant
/usr/local/include/occi/occiControl.h:190: error: `OCI_ATTR_LIST_COLUMNS' was not declared in this scope
/usr/local/include/occi/occiControl.h:190: error: enumerator value for `ATTR_LIST_COLUMNS' not integer constant
/usr/local/include/occi/occiControl.h:191: error: `OCI_ATTR_REF_TDO' was not declared in this scope
/usr/local/include/occi/occiControl.h:191: error: enumerator value for `ATTR_REF_TDO' not integer constant
/usr/local/include/occi/occiControl.h:192: error: `OCI_ATTR_IS_TEMPORARY' was not declared in this scope
/usr/local/include/occi/occiControl.h:192: error: enumerator value for `ATTR_IS_TEMPORARY' not integer constant
/usr/local/include/occi/occiControl.h:193: error: `OCI_ATTR_IS_TYPED' was not declared in this scope
/usr/local/include/occi/occiControl.h:193: error: enumerator value for `ATTR_IS_TYPED' not integer constant
/usr/local/include/occi/occiControl.h:194: error: `OCI_ATTR_DURATION' was not declared in this scope
/usr/local/include/occi/occiControl.h:194: error: enumerator value for `ATTR_DURATION' not integer constant
/usr/local/include/occi/occiControl.h:195: error: `OCI_ATTR_COLLECTION_ELEMENT' was not declared in this scope
/usr/local/include/occi/occiControl.h:195: error: enumerator value for `ATTR_COLLECTION_ELEMENT' not integer constant
/usr/local/include/occi/occiControl.h:196: error: `OCI_ATTR_RDBA' was not declared in this scope
/usr/local/include/occi/occiControl.h:196: error: enumerator value for `ATTR_RDBA' not integer constant
/usr/local/include/occi/occiControl.h:197: error: `OCI_ATTR_TABLESPACE' was not declared in this scope
..................

我不知我的配置哪里有问题?
...全文
53 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

64,648

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

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