简体   繁体   中英

Ubuntu 16.04 LTS and Oracle Instant Client - C++ linking error

I'm not sure if the problem is more suitable for StackOverflow or AskUbuntu , but I will ask. I have two virtual machines. On one Ubuntu 14.04 LTS and the other Ubuntu 16.04 LST. On both installed Oracle Instant Client 12.1 in the following way:

arkadiuszg@ubuntu:~/install/oracle$ ls -1
oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm
oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm

arkadiuszg@ubuntu:~/install/oracle$ sudo alien -i oracle-instantclient12.1-*

arkadiuszg@ubuntu:~/install/oracle$ cd /etc/ld.so.conf.d/

arkadiuszg@ubuntu:/etc/ld.so.conf.d$ sudo touch oracle-instantclient12.1.conf

arkadiuszg@ubuntu:/etc/ld.so.conf.d$ sudo vi oracle-instantclient12.1.conf

In created file I type:

/usr/lib/oracle/12.1/client64/lib

And finally:

arkadiuszg@ubuntu:/etc/ld.so.conf.d$ sudo ldconfig

I am using C++ tools like: g++, make, gdb. Compiling the project runs on both machines correctly, but the problem is linking on Ubuntu 16.04 . I keep getting the following errors:

DbConnection.cpp:(.text+0x536): undefined reference to `oracle::occi::Date::toText(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
build/Release/GNU-Linux/database/DbConnection.o: In function `CDbConnection::connect()':
DbConnection.cpp:(.text+0x1314): undefined reference to `oracle::occi::Environment::createEnvironment(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, oracle::occi::Environment::Mode, void*, void* (*)(void*, unsigned long), void* (*)(void*, void*, unsigned long), void (*)(void*, void*))'
collect2: error: ld returned 1 exit status

When I do exactly this same on Ubuntu 14.04, then everything is OK. Compiling and linking ends with success.

Can anybody help me, please...

It is because of the compiler version. oracle occi is compatible with gcc 4.8.2 check the compiler version to see the differences

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM