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
here it is:
-------------- Build: Debug in OCCITest ---------------
mingw32-g++.exe -L..\..\XEClient\oci\lib\gcc -o bin\Debug\OCCITest.exe obj\Debug\main.o ..\..\XEClient\oci\lib\gcc\liboraocci10d.a
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
Process terminated with status 1 (0 minutes, 0 seconds)
6 errors, 0 warnings
yes, her it is:
------------- Build: Debug in OCCITest ---------------
mingw32-g++.exe -Wall -fexceptions -g -I..\..\XEClient\oci\include -c C:\codeblocksWS\OCCITest\main.cpp -o obj\Debug\main.o
mingw32-g++.exe -L..\..\XEClient\oci\lib\gcc -o bin\Debug\OCCITest.exe obj\Debug\main.o ..\..\XEClient\oci\lib\gcc\liboraocci10.a
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
Process terminated with status 1 (0 minutes, 1 seconds)
6 errors, 0 warnings
Damn, no change... sure I'm not missing some flags?
-------------- Build: Debug in OCCITest ---------------
mingw32-g++.exe -Wall -fexceptions -g -I..\..\XEClient\oci\include -c C:\codeblocksWS\OCCITest\main.cpp -o obj\Debug\main.o
mingw32-g++.exe -L..\..\XEClient\oci\lib\gcc -o bin\Debug\OCCITest.exe obj\Debug\main.o ..\..\XEClient\oci\lib\msvc\oraocci10.lib ..\..\XEClient\oci\lib\msvc\oci.lib ..\..\XEClient\oci\lib\msvc\ociw32.lib
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
Process terminated with status 1 (0 minutes, 2 seconds)
6 errors, 0 warnings
gee, what's the problem here? I really don't understand this...
still, any ideas?
Gal
I found a few in the oraocci10.lib
like this fragment:
oraocci10.dll:
00000000 I .idata$4
00000000 I .idata$5
00000000 I .idata$6
00000000 T .text
00000000 T ??0BatchSQLException@occi@oracle@@AAE@PAVSQLExceptionImpl@12@@Z
00000000 I __imp_??0BatchSQLException@occi@oracle@@AAE@PAVSQLExceptionImpl@12@@Z
oraocci10.dll:
00000000 I .idata$4
00000000 I .idata$5
00000000 I .idata$6
00000000 T .text
00000000 T ??0BatchSQLException@occi@oracle@@QAE@ABV012@@Z
00000000 I __imp_??0BatchSQLException@occi@oracle@@QAE@ABV012@@Z
oraocci10.dll:
00000000 I .idata$4
00000000 I .idata$5
00000000 I .idata$6
00000000 T .text
00000000 T ??0BatchSQLExceptionImpl@occi@oracle@@QAE@PAX0@Z
00000000 I __imp_??0BatchSQLExceptionImpl@occi@oracle@@QAE@PAX0@Z
so why can't the linker see them?
thanks for the patience,
Gal
PS: the 'occi....Environment' is also present in the same file.