Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2003
    Location
    Venice
    Posts
    10

    Unanswered: Problem with compile g++ OCCI

    Hallo everybody,
    I have an Oracle DB in a PC with linux RedHat 9 and a client linux with Oracle client installed.
    In the DB there is a table "inserimento1" that have some field e.g. "ID", "PRIORITA", "TIME",...
    I write this simple C++ code :

    #include <iostream>
    #include <occi.h>
    using namespace oracle:cci;
    using namespace std;

    class occiprova
    {
    private:
    Environment *env;
    Connection *conn;
    Statement *stmt;

    public :
    occiprova (string user, string passwd, string db) throw
    (SQLException)
    {
    env = Environment::createEnvironment (Environment::OBJECT);
    conn = env->createConnection (user, passwd, db);
    }// end of constructor occidesc (string, string, string )

    /*Destructor for the occidesc demo program. */
    ~occiprova () throw (SQLException)
    {
    env->terminateConnection (conn);
    Environment::terminateEnvironment (env);
    } // end of ~occidesc ()

    dvoid select ()
    {
    cout << "retrieving the data" << endl;
    stmt = conn->createStatement
    ("SELECT ID, PRIORITA FROM inserimento1");
    ResultSet *rset = stmt->executeQuery();
    while (rset->next())
    {
    cout << "id:" << rset->getInt (1) << endl;
    cout << "priorita:" << rset->getInt (2) << endl;
    }
    stmt->closeResultSet (rset);
    conn->terminateStatement (stmt);
    } // end of test (Connection *)

    }; // end of class occidesc

    int main (void)
    {
    string user = "testsergio";
    string passwd = "prova1";
    string db = "dbora.lnl.infn.it";

    occiprova *demo = new occiprova (user, passwd, db);
    demo->select();
    delete demo;

    }// end of main ()


    And I compile the file occiprova.cpp with the command:

    g++ -c -I/home/oracle/OracleHome/rdbms/demo -I/home/oracle/OracleHome/rdbms/public -L/home/oracle/OracleHome/lib occiprova.cpp

    now I have the occiprova.o and i try to link with the command:

    g++ -o occiprova occiprova.o
    but I have an error:
    occiprova.o(.gcc_except_table+0x70): undefined reference to `typeinfo for oracle:cci:QLException'
    occiprova.o(.gcc_except_table+0x88): undefined reference to `typeinfo for oracle:cci:QLException'
    occiprova.o: In function `occiprova:cciprova[in-charge](std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
    occiprova.o(.gnu.linkonce.t._ZN9occiprovaC1ESsSsSs +0x14): undefined reference to `oracle:cci::Environment::createEnvironment(oracle:cci::Environment::Mode, void*, void* (*)(void*, unsigned), void* (*)(void*, void*, unsigned), void (*)(void*, void*))'
    occiprova.o: In function `occiprova::~occiprova [in-charge]()':
    occiprova.o(.gnu.linkonce.t._ZN9occiprovaD1Ev+0x2e ): undefined reference to `oracle:cci::Environment::terminateEnvironment(oracle:cci::Environment*)'
    collect2: ld returned 1 exit status


    Someone can help me?
    Thanks in advance
    Hi Sergio

  2. #2
    Join Date
    Nov 2003
    Location
    Bangalore, INDIA
    Posts
    333

    Thumbs up

    HI,

    Are you using the Oracle provided make file to build?
    Are you able to build any of the OCCI samples?
    SATHISH .

  3. #3
    Join Date
    Nov 2003
    Location
    Venice
    Posts
    10

    problem also with demo

    I try to compile a demo with this command :
    make -f demo_rdbms.mk occipool

    but I have a result that is:
    occipool.cpp:11:18: occi.h: No such file or directory
    occipool.cpp:12: parse error before `::' token
    occipool.cpp:19: syntax error before `*' token
    occipool.cpp:20: syntax error before `*' token
    occipool.cpp:21: syntax error before `*' token
    occipool.cpp:42: parse error before `)' token
    occipool.cpp:46: ISO C++ forbids initialization of member `poolUserName'
    occipool.cpp:46: making `poolUserName' static
    occipool.cpp:46: invalid in-class initialization of static data member of
    non-integral type `const std::string'
    occipool.cpp:47: ISO C++ forbids initialization of member `poolPassword'
    occipool.cpp:47: making `poolPassword' static
    occipool.cpp:47: invalid in-class initialization of static data member of
    non-integral type `const std::string'
    occipool.cpp:48: ISO C++ forbids initialization of member `connectString'
    occipool.cpp:48: making `connectString' static
    occipool.cpp:48: invalid in-class initialization of static data member of
    non-integral type `const std::string'
    occipool.cpp:49: ISO C++ forbids initialization of member `username'
    occipool.cpp:49: making `username' static
    occipool.cpp:49: invalid in-class initialization of static data member of
    non-integral type `const std::string'
    occipool.cpp:50: ISO C++ forbids initialization of member `passWord'
    occipool.cpp:50: making `passWord' static
    occipool.cpp:50: invalid in-class initialization of static data member of
    non-integral type `const std::string'
    occipool.cpp:51: ISO C++ forbids initialization of member `maxConn'
    occipool.cpp:51: making `maxConn' static
    occipool.cpp:51: ISO C++ forbids in-class initialization of non-const static
    member `maxConn'
    occipool.cpp:52: ISO C++ forbids initialization of member `minConn'
    occipool.cpp:52: making `minConn' static
    occipool.cpp:52: ISO C++ forbids in-class initialization of non-const static
    member `minConn'
    occipool.cpp:53: ISO C++ forbids initialization of member `incrConn'
    occipool.cpp:53: making `incrConn' static
    occipool.cpp:53: ISO C++ forbids in-class initialization of non-const static
    member `incrConn'
    occipool.cpp:54: syntax error before `*' token
    occipool.cpp:61: `connPool' was not declared in this scope
    occipool.cpp:61: `username' was not declared in this scope
    occipool.cpp:61: `passWord' was not declared in this scope
    occipool.cpp:61: ISO C++ forbids declaration of `con' with no type
    occipool.cpp:61: ISO C++ forbids initialization of member `con'
    occipool.cpp:61: making `con' static
    occipool.cpp:61: ISO C++ forbids in-class initialization of non-const static
    member `con'
    occipool.cpp:62: parse error before `if'
    occipool.cpp:66: semicolon missing after declaration of `occipool'
    occipool.cpp: In constructor `occipool:ccipool()':
    occipool.cpp:28: `env' undeclared (first use this function)
    occipool.cpp:28: (Each undeclared identifier is reported only once for each
    function it appears in.)
    occipool.cpp:28: `Environment' undeclared (first use this function)
    occipool.cpp:28: parse error before `SQLException'
    occipool.cpp: In destructor `occipool::~occipool()':
    occipool.cpp:36: parse error before `SQLException'
    occipool.cpp: At global scope:
    occipool.cpp:66: parse error before `)' token
    occipool.cpp:69: syntax error before `<<' token
    occipool.cpp:70: syntax error before `<<' token
    occipool.cpp:73: syntax error before `<<' token
    occipool.cpp:74: ISO C++ forbids declaration of `stmt' with no type
    occipool.cpp:74: `con' was not declared in this scope
    occipool.cpp:76: syntax error before `*' token
    occipool.cpp:80: syntax error before `<<' token
    occipool.cpp:82: syntax error before `->' token
    occipool.cpp:83: syntax error before `->' token
    occipool.cpp:84: syntax error before `->' token
    occipool.cpp:85: syntax error before `->' token
    occipool.cpp:87: syntax error before `<<' token
    occipool.cpp: In function `int main()':
    occipool.cpp:101: no matching function for call to `occipool::select()'
    make[1]: *** [occipool.o] Error 1
    make[1]: Leaving directory `/home/oracle/OracleHome/rdbms/demo'
    make: *** [occipool] Error 2

    Thanks for helping me.
    Hi Sergio

    Originally posted by satish_ct
    HI,

    Are you using the Oracle provided make file to build?
    Are you able to build any of the OCCI samples?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •