小弟初次使用linux下用OCCI连接oracle 10g,从网上找了一些资料代码,但编译的时候遇到很大的问题,有一些库可能没有连接到,搞的头大,哪位能帮帮小弟,不胜感激~~~
我的编译命令是这样的g++  -I/home/db/oracle/product/10.2.0/db_1/rdbms/public -L/home/db/oracle/product/10.2.0/db_1/rdbms/lib occicoll.cpp
报了很多类似于这样的错误:
/tmp/ccJ0t2ZM.o(.text+0x5d9): In function `main':
: undefined reference to `oracle::occi::SQLException::SQLException(oracle::occi::SQLException const&)'
/tmp/ccJ0t2ZM.o(.text+0x5e6): In function `main':
: undefined reference to `oracle::occi::SQLException::getMessage() const'
/tmp/ccJ0t2ZM.o(.text+0x660): In function `main':
: undefined reference to `oracle::occi::SQLException::~SQLException()'
/tmp/ccJ0t2ZM.o(.text+0x672): In function `main':
: undefined reference to `oracle::occi::SQLException::~SQLException()'
/tmp/ccJ0t2ZM.o(.gcc_except_table+0xa0): undefined reference to `typeinfo for oracle::occi::SQLException'
/tmp/ccJ0t2ZM.o(.gcc_except_table+0x1f0): undefined reference to `typeinfo for oracle::occi::SQLException'
/tmp/ccJ0t2ZM.o(.gcc_except_table+0x2a0): undefined reference to `typeinfo for oracle::occi::SQLException'
/tmp/ccJ0t2ZM.o(.gcc_except_table+0x350): undefined reference to `typeinfo for oracle::occi::SQLException'
/tmp/ccJ0t2ZM.o(.gcc_except_table+0x3c0): undefined reference to `typeinfo for oracle::occi::SQLException'
............
............

解决方案 »

  1.   

    楼主的 问题解决了吗?我试了下二楼的办法,报错:Undefined                       first referenced
     symbol                             in file
    __1cG__CrunKpure_error6F_v_         /opt/ttadmin/TimesTen/tt1121/ttoracle_home/instantclient_11_1/libocci.so
    __1cDstdbC__RTTI__1nDstdMlength_error__ /opt/ttadmin/TimesTen/tt1121/ttoracle_home/instantclient_11_1/libocci.so
    __1cDstdMout_of_range2T6M_v_        /opt/ttadmin/TimesTen/tt1121/ttoracle_home/instantclient_11_1/libocci.so
    __1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___2G6Mpkc_r1_ /opt/ttadmin/TimesTen/tt1121/ttoracle_home/instantclient_11_1/libocci.so
    __1cDstdLlogic_error2t6Mrkn0AMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc_____v_ /opt/ttadmin/TimesTen/tt1121/ttoracle_home/instantclient_11_1/libocci.so
    __1cG__CrunIex_alloc6FL_pv_         /opt/ttadmin/TimesTen/tt1121/ttoracle_home/instantclient_11_1/libocci.so
    __1cG__CrunIex_throw6Fpvpkn0AQstatic_type_info_pF1_v_v_ /opt/ttadmin/TimesTen/tt1121/ttoracle_home/instantclient_11_1/libocci.so
    __1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___2G6Mrk1_r1_ /opt/ttadmin/TimesTen/tt1121/ttoracle_home/instantclient_11_1/libocci.so
    __1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___2t6MpkcLrkn0C__v_ /opt/ttadmin/TimesTen/tt1121/ttoracle_home/instantclient_11_1/libocci.so
    __1cH__rwstdV__null_string_ref_rep4CcnDstdLchar_traits4Cc__n0BJallocator4Cc__n0AQ__string_ref_rep4n0D____2t6M_v_ /opt/ttadmin/TimesTen/tt1121/ttoracle_home/instantclient_11_1/libocci.so
    ...
    ...
      

  2.   

    除了连接指定的动态库外,还要加动态库所在的路径添加到LD_LIBRARY_PATH下。如果代码不多的话,帖出来吧,帮你调试下。