Bonjour,
Je suis actuellement entrain d'ajouter la lib OCILIB à Qt, afin d’atteindre une base de données sous oracle. Je me suis inspiré du tuto suivant : http://vicenzo.developpez.com/tutoriels/c/ocilib/
.pro
mon .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
17
18
19
20
21 QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets LIBS += C:/ocilib/lib32/ociliba.lib INCLUDEPATH = C:/ocilib/include DEFINES += OCI_API=__sdtcall TARGET = BDD TEMPLATE = app SOURCES += main.cpp\ commu.cpp HEADERS += commu.h FORMS += commu.ui
mon .h
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
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39 Commu::Commu(QWidget *parent) : QMainWindow(parent), ui(new Ui::Commu) { ui->setupUi(this); } Commu::~Commu() { delete ui; } void Commu::on_btnFusion_clicked() { OCI_Connection* cn; OCI_Statement* st; OCI_Resultset* rs; if(!OCI_Initialize(NULL, NULL, OCI_ENV_DEFAULT)) exit(88); QMessageBox::information(this, "info", "oh yeah"); cn = OCI_ConnectionCreate("bd", "user", "pwd", OCI_SESSION_DEFAULT); if (cn != NULL) { printf(OCI_GetVersionServer(cn)); printf("Server major version : %i\n", OCI_GetServerMajorVersion(cn)); printf("Server minor version : %i\n", OCI_GetServerMinorVersion(cn)); printf("Server revision version : %i\n", OCI_GetServerRevisionVersion(cn)); printf("Connection version : %i\n", OCI_GetVersionConnection(cn)); OCI_ConnectionFree(cn); } OCI_Cleanup(); }
Et en erreur, j'ai :
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
17
18
19
20
21
22
23
24
25
26
27 #include <QMainWindow> #include <QMessageBox> #include <cstdlib> #include <iostream> #include "ocilib.h" namespace Ui { class Commu; } class Commu : public QMainWindow { Q_OBJECT public: explicit Commu(QWidget *parent = 0); ~Commu(); private slots: void on_btnFusion_clicked(); private: Ui::Commu *ui; }; #endif // COMMU_H
c:\ocilib\include/ocilib.h:2067:28: error: expected initializer before 'OCI_Initialize'
c:\ocilib\include/ocilib.h:2092:28: error: expected initializer before 'OCI_Cleanup'
c:\ocilib\include/ocilib.h:2109:33: error: expected initializer before 'OCI_GetOCICompileVersion'
c:\ocilib\include/ocilib.h:2126:33: error: expected initializer before 'OCI_GetOCIRuntimeVersion'
c:\ocilib\include/ocilib.h:2142:33: error: expected initializer before 'OCI_GetImportMode'
c:\ocilib\include/ocilib.h:2158:33: error: expected initializer before 'OCI_GetCharsetMetaData'
c:\ocilib\include/ocilib.h:2174:33: error: expected initializer before 'OCI_GetCharsetUserData'
...
et ainsi de suite pour toute les fonctions de la lib. Je suis complétement bloqué, si quelqu’un sait comment résoudre ce problème je suis preneur!
merci d'avance.
Washco
Partager