6 Replies Latest reply: Mar 2, 2010 3:00 AM by 807559 RSS

    Linking error

    807559
      Hi Guys,

      I am facing a issue while trying to build exe for following CPP
      file, The undefined symbol issue error is appearing, please advice if i am missing something on namespace or buliding command

      #include<iostream.h>
      #include<occi.h>
      using namespace std;
      using namespace oracle::occi;
      int main(){
      Environment *envr;
      envr=Environment::createEnvironment(Environment::DEFAULT);
      cout<<"test";
      }



      g++ -I/oraclehome/oracle/product/10.2.0/IMITEST/rdbms/public/ -L/oraclehome/oracle/product/10.2.0/IMITEST/lib -locci -lclntsh -m64 test_occi.cpp

      In file included from /usr/sfw/lib/gcc/i386-pc-solaris2.10/3.4.3/../../../../include/c++/3.4.3/backward/iostream.h:31,from test_occi.cpp:1:

      /usr/sfw/lib/gcc/i386-pc-solaris2.10/3.4.3/../../../../include/c++/3.4.3/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.

      Undefined first referenced
      symbol in file
      __1cG__CrunKpure_error6F_v_ /oraclehome/oracle/product/10.2.0/IMITEST/lib/libocci.so
      __1cDstdbC__RTTI__1nDstdMlength_error__ /oraclehome/oracle/product/10.2.0/IMITEST/lib/libocci.so
      __1cDstdMout_of_range2T6M_v_ /oraclehome/oracle/product/10.2.0/IMITEST/lib/libocci.so
      __1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___2G6Mpkc_r1_ /oraclehome/oracle/product/10.2.0/IMITEST/lib/libocci.so
      __1cDstdLlogic_error2t6Mrkn0AMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc_____v_ /oraclehome/oracle/product/10.2.0/IMITEST/lib/libocci.so
      __1cG__CrunIex_alloc6FL_pv_ /oraclehome/oracle/product/10.2.0/IMITEST/lib/libocci.so
      __1cG__CrunIex_throw6Fpvpkn0AQstatic_type_info_pF1_v_v_ /oraclehome/oracle/product/10.2.0/IMITEST/lib/libocci.so
      __1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___2G6Mrk1_r1_ /oraclehome/oracle/product/10.2.0/IMITEST/lib/libocci.so
      __1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___2t6MpkcLrkn0C__v_ /oraclehome/oracle/product/10.2.0/IMITEST/lib/libocci.so
        • 1. Re: Linking error
          wrobbins2
          /oraclehome/oracle/product/... ???

          My guess is your ORACLE_HOME is /oracle/product/...

          So take off the leading +/oraclehome+
          • 2. Re: Linking error
            807559
            ORACLEHOME id resolved to /oraclehome
            since i am not setting the env ORACLEHOME first
            i am giving the complete path for the include
            • 3. Re: Linking error
              807559
              The error as i have mentioned above appear for lCrun and lCstd and they are both
              in /usr/lib/amd64/ and i have also cross verified the mangled name in each of these lib
              and they appear defined there

              nm libCrun.so.1| grep __1cG__CrunKpure_error6F_v_

              [272] | 43328| 26|FUNC |GLOB |0 |16 |__1cG__CrunKpure_error6F_v_



              Also i have linked the lib path -L/usr/lib/amd

              but am still getting the same errors

              Please Advice
              • 4. Re: Linking error
                paul_floyd
                Hi
                I am facing a issue while trying to build exe for following CPP
                file, The undefined symbol issue error is appearing, please advice if i am missing something on namespace or buliding command

                #include<iostream.h>
                That's really old. If you want real C++, include <iostream>.
                #include<occi.h>
                using namespace std;
                Ugh.
                using namespace oracle::occi;
                int main(){
                Environment *envr;
                envr=Environment::createEnvironment(Environment::DEFAULT);
                cout<<"test";
                }
                g++ -I/oraclehome/oracle/product/10.2.0/IMITEST/rdbms/public/ -L/oraclehome/oracle/product/10.2.0/IMITEST/lib -locci -lclntsh -m64 test_occi.cpp
                First part of your problem: trying to build with GCC's g++.

                >
                In file included from /usr/sfw/lib/gcc/i386-pc-solaris2.10/3.4.3/../../../../include/c++/3.4.3/backward/iostream.h:31,from test_occi.cpp:1:

                /usr/sfw/lib/gcc/i386-pc-solaris2.10/3.4.3/../../../../include/c++/3.4.3/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.

                Undefined first referenced
                symbol in file
                __1cG__CrunKpure_error6F_v_ /oraclehome/oracle/product/10.2.0/IMITEST/lib/libocci.so
                Second part of your problem. The Oracle libraries were built with Sun Studio CC.

                You can't mix and match C++ compilers (generally). If you need to link with libraries built with Sun Studio CC, then all your C++ code needs to be built with it.

                So, 2 possibilities:
                If a GCC g++ version of the Oracle libraries exists, you could use them.
                Alternatively, download and install Sun Studio (available at zero cost).

                A+
                Paul
                • 5. Re: Linking error
                  807559
                  Thanks Paul!! yes i did got to know that we need a SUN STUDIO CC and it is working fine.
                  Appreciate your valuable inputs.
                  • 6. Re: Linking error
                    807559
                    Thanks to the forum!!