Home » Developer & Programmer » Precompilers, OCI & OCCI » Linux OCCI C++ compile error
Linux OCCI C++ compile error [message #125727] Tue, 28 June 2005 22:23 Go to next message
nelnel
Messages: 5
Registered: June 2005
Location: HongKOng
Junior Member
i am facing one problem of the Linking Library. I can't successfully compile the program.

My system standard is:
Redhat 9.2
Oracle 9i Client
GCC 3.2

The test.cpp file:

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

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

public:

testOcci (string user, string passwd, string db)
{
env = Environment::createEnvironment (Environment::DEFAULT);
conn = env->createConnection( user, passwd, db);
}
~testOcci ()
{
env->terminateConnection(conn);
Environment::terminateEnvironment (env);
}

};
int main(void)
{
string user="test";
string passwd="test";
string db="spdc";

testOcci *demo = new testOcci (user, passwd, db);
cout << "Creation Successful" << endl;
delete (demo);
cout << "Deletion Successful" << endl;

return 0;
}

Command to compile:
[oracle@H733-00011 oracle]$ g++ -L/opt/oracle/product/9.2.0/lib -L/opt/oracle/product/9.2.0/rdbms/lib -I/opt/oracle/product/9.2.0/rdbms/public -I/opt/oracle/product/9.2.0/rdbms/demo -o test.o -c test.cpp
[oracle@H733-00011 oracle]$ g++ -o test test.o

Error Message:
test.o(.gnu.linkonce.t._ZN8testOcciC1ESsSsSs+0x20): In function `testOcci::testOcci[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> > )':
: undefined reference to `oracle::occi::Environment::createEnvironment(oracle::occi::Environment::Mode, void*, void* (*)(void*, unsigned), void* (*)(void*, void*, unsigned), void (*)(void*, void*))'
test.o(.gnu.linkonce.t._ZN8testOcciD1Ev+0x2e): In function `testOcci::~testOcci [in-charge]()':
: undefined reference to `oracle::occi::Environment::terminateEnvironment(oracle::occi::Environment*)'
collect2: ld returned 1 exit status
[

what's problem ?? Is the enivornment variable problem??s

>>I Know that gcc 3.2 will cause the the problem of compilation error when linking with OCCI. But are there any solution to solve it without installing another GCC version??

Thx for ur help.s
Re: Linux OCCI C++ compile error [message #125750 is a reply to message #125727] Wed, 29 June 2005 02:06 Go to previous message
nelnel
Messages: 5
Registered: June 2005
Location: HongKOng
Junior Member
i have installed GCC 2.95.3 now , but still can't compile the program. it still show the error message:

test.o(.testOcci::gnu.linkonce.t.(basic_string<char, string_char_traits<char>, __default_alloc_template<true, 0> >, basic_string<char, string_char_traits<char>, __default_alloc_template<true, 0> >, basic_string<char, string_char_traits<char>, __default_alloc_template<true, 0> >)+0x1d): In function `testOcci::testOcci(basic_string<char, string_char_traits<char>, __default_alloc_template<true, 0> >, basic_string<char, string_char_traits<char>, __default_alloc_template<true, 0>
>, basic_string<char, string_char_traits<char>, __default_alloc_template<true, 0> >)':
: undefined reference to `oracle::occi::Environment::createEnvironment(oracle::occi::Environment::Mode, void *, void *(*)(void *, unsigned int), void *(*)(void
*, void *, unsigned int), void (*)(void *, void *))'
test.o(.gnu.linkonce.t._._8testOcci+0x2e): In function `testOcci::~testOcci(void)':
: undefined reference to `oracle::occi::Environment::terminateEnvironment(oracle::occi::Environment *)'
collect2: ld returned 1 exit status
s
Previous Topic: Compilation of C components following Oracle 9i upgrade
Next Topic: pro*c Exe file
Goto Forum:
  


Current Time: Tue Mar 19 01:47:00 CDT 2024