solaris 10 下用OCCI操作oracle 10g链接出错!!!
程序:
#include <iostream>
#include <string>
#include <occi.h>
#include <occiCommon.h>
#include <occiData.h>
#include <occiObjects.h>
#include <occiAQ.h>
#include <occiControl.h>
using namespace oracle::occi;
using namespace std;
int main()
{
Environment *env;
Connection *conn;
string userName = "system";
string password = "omcdb";
string database = "192.168.20.223/omcdb";
env=Environment::createEnvironment(Environment::OBJECT);
conn=env->createConnection(userName,password,database);
cout << "OCCI Environment and Connection Created " << endl;
return 0;
}
=====================
编译:
g++ -o oracleDemo oracleDemo.cpp -I $ORACLE_HOME/rdbms/public -L $ORACLE_HOME/lib -lclntsh -locci
=====================================
编译可以通过,链接出现错误:
未定义符号 在文件中
__1cG__CrunKpure_error6F_v_ /export/home/oracle/product/10gr2/lib/libocci.so
__1cDstdbC__RTTI__1nDstdMlength_error__ /export/home/oracle/product/10gr2/lib/libocci.so
__1cDstdMout_of_range2T6M_v_ /export/home/oracle/product/10gr2/lib/libocci.so
__1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___2G6Mpkc_r1_ /export/home/oracle/product/10gr2/lib/libocci.so
__1cDstdLlogic_error2t6Mrkn0AMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc_____v_ /export/home/oracle/product/10gr2/lib/libocci.so
__1cG__CrunIex_alloc6FI_pv_ /export/home/oracle/product/10gr2/lib/libocci.so
__1cG__CrunIex_throw6Fpvpkn0AQstatic_type_info_pF1_v_v_ /export/home/oracle/product/10gr2/lib/libocci.so
__1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___2G6Mrk1_r1_ /export/home/oracle/product/10gr2/lib/libocci.so
__1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___2t6MpkcIrkn0C__v_ /export/home/oracle/product/10gr2/lib/libocci.so
__1cH__rwstdV__null_string_ref_rep4CcnDstdLchar_traits4Cc__n0BJallocator4Cc__n0AQ__string_ref_rep4n0D____2t6M_v_ /export/home/oracle/product/10gr2/lib/libocci.so
__1cH__rwstdRexcept_msg_string2t6MIE_v_ /export/home/oracle/product/10gr2/lib/libocci.so
__1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___2t6Mpkcrkn0C__v_ /export/home/oracle/product/10gr2/lib/libocci.so
__1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___2T6M_v_ /export/home/oracle/product/10gr2/lib/libocci.so
__1cH__rwstdbC__rwse_StringIndexOutOfRange_ /export/home/oracle/product/10gr2/lib/libocci.so
__1cDstdZ__RTTI__1nDstdJbad_alloc__ /export/home/oracle/product/10gr2/lib/libocci.so
__1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___Gassign6Mrk1II_r1_ /export/home/oracle/product/10gr2/lib/libocci.so
__1cG__CrunRex_chk_unexpected6F_v_ /export/home/oracle/product/10gr2/lib/libocci.so
__1cH__rwstdX__rwse_InvalidSizeParam_ /export/home/oracle/product/10gr2/lib/libocci.so
__1cDstdJbad_alloc2t6M_v_ /export/home/oracle/product/10gr2/lib/libocci.so
__1cH__rwstdbB__rwse_PosBeyondEndOfString_ /export/home/oracle/product/10gr2/lib/libocci.so
__1cH__rwstdUInterlockedDecrement6Fpl_l_ /export/home/oracle/product/10gr2/lib/libocci.so
__1cH__rwstdUInterlockedIncrement6Fpl_l_ /export/home/oracle/product/10gr2/lib/libocci.so
__1cDstdbC__RTTI__1nDstdMout_of_range__ /export/home/oracle/product/10gr2/lib/libocci.so
__1cDstdLlogic_error2T6M_v_ /export/home/oracle/product/10gr2/lib/libocci.so
__1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___I__getRep6MII_pnH__rwstdM__string_ref4Ccn0B_n0C____ /export/home/oracle/product/10gr2/lib/libocci.so
__1cH__rwstdTInterlockedExchange6Fpll_l_ /export/home/oracle/product/10gr2/lib/libocci.so
__1cDstdJallocator4Cc_2t6M_v_ /export/home/oracle/product/10gr2/lib/libocci.so
__1cDstdMlength_error2t6Mrkn0AMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc_____v_ /export/home/oracle/product/10gr2/lib/libocci.so
__1cH__rwstdY__rwse_UnexpectedNullPtr_ /export/home/oracle/product/10gr2/lib/libocci.so
__1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___2t6Mrk1IIrkn0C__v_ /export/home/oracle/product/10gr2/lib/libocci.so
__1cDstdMlength_error2T6M_v_ /export/home/oracle/product/10gr2/lib/libocci.so
oracle:cci::Environment::createEnvironment(oracle:cci::Environment::Mode, void*, void* (*)(void*, unsigned int), void* (*)(void*, void*, unsigned int), void (*)(void*, void*))/var/tmp//cceKWQbg.o
__1cDstdMout_of_range2t6Mrkn0AMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc_____v_ /export/home/oracle/product/10gr2/lib/libocci.so
__1cG__CrunGex_get6F_pv_ /export/home/oracle/product/10gr2/lib/libocci.so
__1c2n6FIpv_0_ /export/home/oracle/product/10gr2/lib/libocci.so
__1cDstdJexceptionG__vtbl_ /export/home/oracle/product/10gr2/lib/libocci.so
__1cDstdJbad_allocG__vtbl_ /export/home/oracle/product/10gr2/lib/libocci.so
__1cG__CrunMex_rethrow_q6F_v_ /export/home/oracle/product/10gr2/lib/libocci.so
__1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___Hcompare6kMIIpkcI_i_ /export/home/oracle/product/10gr2/lib/libocci.so
__1cH__rwstdX__rwse_ResultLenInvalid_ /export/home/oracle/product/10gr2/lib/libocci.so
__1cG__CrunSregister_exit_code6FpG_v_v_ /export/home/oracle/product/10gr2/lib/libocci.so
__1cG__CrunHex_skip6F_b_ /export/home/oracle/product/10gr2/lib/libocci.so
__1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___Hreplace6MIIpkcIII_pc_ /export/home/oracle/product/10gr2/lib/libocci.so
__1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___I__unLink6M_v_ /export/home/oracle/product/10gr2/lib/libocci.so
__1cG__CrunIex_clean6F_v_ /export/home/oracle/product/10gr2/lib/libocci.so
__1cG__CrunKex_rethrow6F_v_ /export/home/oracle/product/10gr2/lib/libocci.so
__1cDstdbB__RTTI__1nDstdLlogic_error__ /export/home/oracle/product/10gr2/lib/libocci.so
__1cH__rwstdRexcept_msg_stringGmsgstr6kM_pkc_ /export/home/oracle/product/10gr2/lib/libocci.so
__1c2k6Fpv0_v_ /export/home/oracle/product/10gr2/lib/libocci.so
c::c(N6, (int0_t)) /export/home/oracle/product/10gr2/lib/libocci.so
c::c(n6, (int0_t)) /export/home/oracle/product/10gr2/lib/libocci.so
__1c2K6Fpv_v_ /export/home/oracle/product/10gr2/lib/libocci.so
__1c2k6Fpv_v_ /export/home/oracle/product/10gr2/lib/libocci.so
=========================================================================
系统环境:
gcc-3.4.6
oracle 10gr2
solaris 10g
=======================================================
请问一下,这是什么原因?用Pro*C/C++可以用,想用一下OCCI却出现这种错误。
[解决办法]
编译库问题