I'm trying to connect my C++ program to Oracle database(12.1).
My C++ program at the moment is (I am using mingw64 g++ compiler in windows):
#include <occi.h>
void oracle_connect()
{
using namespace oracle::occi;
using namespace std;
Environment *env;
Connection *conn;
Statement *stmt;
env = Environment::createEnvironment (Environment::DEFAULT);
conn = env->createConnection ("dasdas", "dasdas", "dasdas");
}
int main()
{
oracle_connect();
}
I compile my program using this command:
g++ test.cpp -loci -lociw32 -loraocci12
All those libraries (oraocci12.lib ociw32.lib oci.lib) are from my oracle folder: oracle\\product\\12.1.0\\client_1\\oci\\lib\\msvc
But I got error during compilation:
undefined reference to `oracle::occi::Environment::createEnvironment(oracle::occi::Environment::Mode, void*, void* (*)(void*, unsigned int), void* (*)(void*, void*, unsigned int), void (*)(void*, void*))'
How should I properly link over my program to successfuly compile it?
In the project I am working the config is the following
#----- Environnement specifique Oracle -----
ORACLEINC = $(ORACLE_HOME_DEV)/include
ORACLELIB = $(ORACLE_HOME_DEV)/lib32
ORACLEBIN = $(ORACLE_HOME_DEV)/bin
ORAINC = -I$(ORACLEINC) -I$(ORACLE_HOME_DEV)/rdbms/demo -I$(ORACLE_HOME_DEV)/precomp/public -I$(ORACLE_HOME_DEV)/plsql/public -I$(ORACLE_HOME_DEV)/network/public
ORALIB = -L$(ORACLELIB) -L$(ORACLE_HOME_DEV)/rdbms/lib -L$(ORACLE_HOME_DEV)/precomp/lib -L$(ORACLE_HOME_DEV)/plsql/lib -L$(ORACLE_HOME_DEV)/network/lib
where ORACLE_HOME_DEV --> /exec/products/oracle/v10.2/
The library you are looking for shoule be here
libocci.a.10.1 -> /exec/products/oracle/v10.2/lib32/libocci.a
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.