Hi there,
Using Xcode, I am trying to write a dummy C++ program to connect to a database.
int main(int argc, const char * argv[]) {
// Create an environment
oracle::occi::Environment *env = oracle::occi::Environment::createEnvironment();
{
oracle::occi::Connection *conn = env->createConnection("usr", "pwd", "db");
oracle::occi::Statement *stmt = conn->createStatement("SELECT mycolumn FROM mytable");
oracle::occi::ResultSet *rs = stmt->executeQuery();
rs->next();
oracle::occi::Number b = rs->getNumber(1);
std::cout << "Number of sessions : " << b.operator int();
stmt->closeResultSet(rs);
conn->terminateStatement(stmt);
env->terminateConnection(conn);
}
// Terminate environment
oracle::occi::Environment::terminateEnvironment(env);
}
Compilation step fails with with a link issue
Undefined symbols for architecture x86_64:
"oracle::occi::Environment::createEnvironment(oracle::occi::Environment::Mode, void*, void* (*)(void*, unsigned long), void* (*)(void*, void*, unsigned long), void (*)(void*, void*))", referenced from:
_main in main.o
"oracle::occi::Environment::terminateEnvironment(oracle::occi::Environment*)", referenced from:
_main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I a added the path to the libraries of instantclient 12.2 to env variable DYLD_LIBRARY_PATH but it did not help.
This path was added to the library search paths of Xcode.
Would you have an idea how to solve this issue?
Thanks a lot in advance,
A C++ beginner