Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Undefined symbols for architecture x86_64: "oracle::occi::Environment::..."

3782129Mar 30 2019 — edited Apr 1 2019

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

This post has been answered by 3782129 on Mar 30 2019
Jump to Answer

Comments

Processing

Post Details

Added on Mar 30 2019
1 comment
1,660 views