Skip to Main Content

Oracle Database Express Edition (XE)

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!

[Resolved] Problem to compile with MinGW on Windows XP

937239May 17 2012 — edited May 24 2012
Hi all,
I would want to create a simple program in C++ that allows to be connected to database Oracle 11g r2 Express. I'm Windows XP professional, I use Code:: Blocks with compiler MinGW (GCC for Windows).
The example code that I have written is the following:
#include <iostream>
#include <occi.h>

#define db_user_name "hr"
#define db_password "hr"
#define db_conn_str "giorgio:1521/xe"

using namespace std;
using namespace oracle::occi;

int main(void)
{
    try {
        Environment *env = Environment::createEnvironment(Environment::DEFAULT);
        Connection *conn = env->createConnection(db_user_name, db_password, db_conn_str);

        env->terminateConnection(conn);
        Environment::terminateEnvironment(env);
    }
    catch(SQLException &sqlExcp) {
        cerr << sqlExcp.getErrorCode() << sqlExcp.getMessage() << endl;
    }

    return 0;
}
in the compiler I indicate the path following:

C:\app\giorgik\product\11.2.0\client_1\oci\lib\msvc\vc9\oraocci11.lib
C:\app\giorgik\product\11.2.0\client_1\oci\include

I obtain this message of error:
obj\Release\main.o:main.cpp|| undefined reference to `oracle::occi::Environment::createEnvironment(oracle::occi::Environment::Mode, void*, void* (*)(void*, unsigned int), void* (*)(void*, void*, unsigned int), void (*)(void*, void*))'|
obj\Release\main.o:main.cpp|| undefined reference to `oracle::occi::Environment::terminateEnvironment(oracle::occi::Environment*)'|
||=== Build finished: 2 errors, 0 warnings ===|

where mistake ?

Edited by: giorgik on 24-mag-2012 19.39
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 21 2012
Added on May 17 2012
2 comments
1,139 views