我试图用OCCI库编译一个基本程序。
编译任务正常。
g++ -I. -g -I/opt/oracle/product/10.2.0/db_1/precomp/public -I/opt/oracle/product/10.2.0/db_1/rdbms/public -I/opt/oracle/product/10.2.0/db_1/rdbms/demo -I/opt/oracle/product/10.2.0/db_1/plsql/public -I/opt/oracle/product/10.2.0/db_1/network/public -DMAX_SEND_SIZE=2000 -c -o test.o test.cpp输出正常,生成test.o。但是,当我想用以下命令链接对象文件时,
g++ -L/opt/oracle/product/10.2.0/db_1/lib/ -lclntsh -locci -o test test.o链接任务失败,输出如下:
test.o: In function `main':
/home/xxx/occi/test.cpp:128: undefined reference to `oracle::occi::Environment::createEnvironment(oracle::occi::Environment::Mode, void*, void* (*)(void*, unsigned int), void* (*)(void*, void*, unsigned int), void (*)(void*, void*))'
/home/xxx/occi/test.cpp:170: undefined reference to `oracle::occi::Environment::terminateEnvironment(oracle::occi::Environment*)'
/home/xxx/occi/test.cpp:158: undefined reference to `oracle::occi::SQLException::~SQLException()'
/home/xxx/occi/test.cpp:158: undefined reference to `oracle::occi::SQLException::SQLException(oracle::occi::SQLException const&)'
/home/xxx/occi/test.cpp:163: undefined reference to `oracle::occi::SQLException::what() const'
/home/xxx/occi/test.cpp:158: undefined reference to `oracle::occi::SQLException::~SQLException()'
test.o:(.gcc_except_table+0xe0): undefined reference to `typeinfo for oracle::occi::SQLException'
collect2: ld returned 1 exit status我的环境简历:
Ubuntu 11.04
)
你能帮我吗?,我真的需要在Linux中使用OCCI创建一个与Oracle的连接,我不想使用Pro*C。
发布于 2012-08-03 03:10:52
要使用OCCI,您需要安装Oracle提供的即时客户端(您安装了吗?)我使用Oracle 11.2,所以我的包含目录路径是/usr/ include /oracle/11.2/client64 64,我的共享库是/usr/lib/oracle/11.2/client64 64/lib。
我在这里看到的
http://173.255.217.246:8000/mapnik_trac/wiki/OCCI10.2路径为/usr/lib/oracle/10.2.0.4/client/include和/usr/lib/oracle/10.2.0.4/client/lib
在11.2中,我还需要首先以http://xme.im/connect-oracle-database-eclipse-linux-using-occi的形式链接到http://xme.im/connect-oracle-database-eclipse-linux-using-occi库
这是一个关于即时客户端http://oradim.blogspot.com/2009/08/getting-started-with-occi-linux-version.html的有用的博客描述
https://stackoverflow.com/questions/11000163
复制相似问题