Bonjour, j'ai tenter de suivre le tutoriel sur OCILIB réalisé par Vincent Rogier.

J' ai quelques soucis (vous devez vous en douter, sinon je ne posterai pas ici).

Je travaille :
- sous windows XP
- avec la dernière version d'eclipse cdt
- mon compilateur est cygwin
- la version OCILIB est 3.3.0

Mon but est de faire une simple requête SQL sur une database oracle (10g).

Mon arborescence est :

- ws (workspace eclipse)
- - test (projet c++ eclipse)
- - - dll (répertoire avec ociliba.dll)
- - - lib (répertoire avec ociliba.lib)
- - - src (contenant test.cpp et ocilib.h)

pour :

- ociliba.lib : project > properties > C/C++ Build > Settings > Cygwin C++ linker > Library search path (-L) = ${workspace_loc:/test/lib}

- ociliba.dll : j'édite mon PATH windows : C:\...\ws\test\dll\ociliba.dll;

- test.cpp :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <iostream>
using namespace std;
#include "ocilib.h"
 
int main()
{
    if (!OCI_Initialize(NULL, NULL, OCI_ENV_DEFAULT))
        return EXIT_FAILURE;
 
    /* ... application code here ... */
 
    OCI_Cleanup();
 
 
    return EXIT_SUCCESS;
}
-----------------------------------------------------------------------

Pour le préprocesseur et la modifiaction de OCI_API=__sdtcall je vais dans :
project > properties > C/C++ Build > Settings > Cygwin C++ > Preprocessor : seulement je n'obtient que des erreurs quand j'essaye de mettre OCI_API=__sdtcall.

1
------------------------------------------------------------------------
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
**** Build of configuration Debug for project test ****
 
make all 
Building file: ../src/test.cpp
Invoking: Cygwin C++ Compiler
g++ -E -DOCI_API=__sdtcall -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/test.d" -MT"src/test.d" -o"src/test.o" "../src/test.cpp"
Finished building: ../src/test.cpp
 
Building target: test.exe
Invoking: Cygwin C++ Linker
g++ -L"C:\0 - home\ws\test\lib" -o"test.exe"  ./src/test.o   
./src/test.o: file not recognized: File format not recognized
collect2: ld returned 1 exit status
make: *** [test.exe] Error 1
----------------------------------------------------------------------
2 - quand j'enlève le -E j'obtiens un nombre impressionnant d'erreurs.
3 - quand je ne mets rien dans le préprocessor j'obtients :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
**** Build of configuration Debug for project test ****
 
make all 
Building file: ../src/test.cpp
Invoking: Cygwin C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/test.d" -MT"src/test.d" -o"src/test.o" "../src/test.cpp"
Finished building: ../src/test.cpp
 
Building target: test.exe
Invoking: Cygwin C++ Linker
g++ -L"C:\0 - home\ws\test\lib" -o"test.exe"  ./src/test.o   
./src/test.o: In function `main':
/cygdrive/c/0 - home/ws/test/Debug/../src/test.cpp:15: undefined reference to `_OCI_Initialize'
/cygdrive/c/0 - home/ws/test/Debug/../src/test.cpp:20: undefined reference to `_OCI_Cleanup'
collect2: ld returned 1 exit status
make: *** [test.exe] Error 1
------------------------------------------------------------------------

Je sais qu'il manque certaines informations. Car je ne suis pas un grand spécialiste du C++ (je suis plutôt java ...). Mais pouvez vous m'aider. Car je ne savais pas qu'il était si difficile de faire une requête en C/C++, par rapport à java.

Je vous remercie d'avance pour vos futures réponses.