Hello again, just got back to this project and, still, unable to link a simple test, here is the steps I did:
(using gcc and not borland)
!) used mingw's util 'reimp' to convert the .lib (msvc) file of occi, oci to a .a files.
2) added this files to the linker tab of the build options.
3) tried to build this main.cpp:
#include <iostream>
#include <occi.h>
using namespace oracle::occi;
using namespace std;
class occidml
{
private:
Environment *env;
Connection *conn;
Statement *stmt;
public:
occidml (string user, string passwd, string db)
{
env = Environment::createEnvironment (Environment::DEFAULT);
conn = env->createConnection (user, passwd, db);
}
~occidml ()
{
env->terminateConnection (conn);
Environment::terminateEnvironment (env);
}
};
int main()
{
string user = "HR";
string passwd = "HR";
string db = "localhost:1521/XE";
try
{
cout << "occidml - Exhibiting simple insert, delete & update operations"
<< endl;
occidml *demo = new occidml (user, passwd, db);
delete (demo);
cout << "occidml - done" << endl;
}
catch (SQLException ea)
{
cerr << "Error running the demo: " << ea.getMessage () << endl;
}
}
and got:
-------------- Build: Debug in OCCITest ---------------
Linking console executable: bin\Debug\OCCITest.exe
obj\Debug\main.o: In function `main':
C:/codeblocksWS/OCCITest/main.cpp:43: undefined reference to `oracle::occi::SQLException::SQLException(oracle::occi::SQLException const&)'
C:/codeblocksWS/OCCITest/main.cpp:45: undefined reference to `oracle::occi::SQLException::getMessage() const'
C:/codeblocksWS/OCCITest/main.cpp:45: undefined reference to `oracle::occi::SQLException::~SQLException()'
C:/codeblocksWS/OCCITest/main.cpp:45: undefined reference to `oracle::occi::SQLException::~SQLException()'
obj\Debug\main.o: In function `ZN7occidmlC1ESsSsSs':
C:/codeblocksWS/OCCITest/main.cpp:(.text$_ZN7occidmlD1Ev[occidml::~occidml()]+0x2f): undefined reference to `oracle::occi::Environment::terminateEnvironment(oracle::occi::Environment*)'
C:/codeblocksWS/OCCITest/main.cpp:(.text$_ZN7occidmlC1ESsSsSs[occidml::occidml(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)]+0x3a): undefined reference to `oracle::occi::Environment::createEnvironment(oracle::occi::Environment::Mode, void*, void* (*)(void*, unsigned int), void* (*)(void*, void*, unsigned int), void (*)(void*, void*))'
collect2: ld returned 1 exit status\
any ideas?
also, how exactly and where exactly can I link directly to the oracocci10.dll file? tried putting the file name (with path) in the
'build options > linker setting > other linker options' text box, and the compiler/linker didn't run.
Thanks a lot.
Gal