Bonjour,
Je me lance aujourd'hui dans ma premiére dll sous Qt et j'ai un petit probléme lors de l'éxécution d'une des classe de ma librairie dans un programme.
Alors j'explique tout ca, j'ai ma dll Qt qui s'appelle PROCESS_LIB. dans cette dll j'ai 3 fichier.
le premier processlib_global.h :
Le second Material.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 #ifndef PROCESSLIB_GLOBAL_H #define PROCESSLIB_GLOBAL_H #include <QtCore/qglobal.h> #include <QVariant> #include <QStandardItemModel> #include <QStandardItem> #if defined(PROCESSLIB_LIBRARY) # define PROCESSLIBSHARED_EXPORT Q_DECL_EXPORT #else # define PROCESSLIBSHARED_EXPORT Q_DECL_IMPORT #endif #endif // PROCESSLIB_GLOBAL_H
et le 3, c'est <gras>Material.cpp</gras> qui est sans importance.
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 #ifndef MATERIAL_H #define MATERIAL_H #include "ProcessLib_global.h" class PROCESSLIBSHARED_EXPORT Material { public: Material(); Material(const Material& other); ~Material(); inline const int& Id() {return _Id;} inline const int& Goal() {return _Goal;} inline const int& Reach() {return _Reach;} inline const int& Humidity() {return _Humidity;} QStandardItemModel GetModel(); static void InitMaterialSystem (); private: QStandardItemModel _Model; int _Id; int _Goal; int _Reach; int _Humidity; friend QDataStream & operator << (QDataStream &, const Material &); friend QDataStream & operator >> (QDataStream &, Material &); }; Q_DECLARE_METATYPE(Material) QDataStream & operator << (QDataStream & out, const Material & Valeur); QDataStream & operator >> (QDataStream & in, Material & Valeur); #endif // MATERIAL_H
Ensuite j'ai un programme test avec le main suivant:
et le .pro de Qt creator comme suivant:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 #include <QtGui/QApplication> #include <QtGui> #include <Material.h> int main(int argc, char argv[]) { QApplication a(argc, argv); Material mat; return a.exec(); }
CONSEQUENCES:
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 # ------------------------------------------------- # Project created by QtCreator 2010-06-18T15:58:42 # ------------------------------------------------- TARGET = Test TEMPLATE = app SOURCES += main.cpp \ widget.cpp HEADERS += widget.h PROCESS_LIB_PATH = ../ProcessLib DEFINES += PROCESSLIB_LIBRARY INCLUDEPATH += $$PROCESS_LIB_PATH CONFIG(debug, debug|release):LIBS += -L$$PROCESS_LIB_PATH\debug\ -lProcessLib else:LIBS += -L$$PROCESS_LIB_PATH\release \ -lProcessLib
Quand j'exécute en release j'ai l'erreur suivante:
et quand je l'éxécute en debug avec un point d'arret Qt creator bug. est ce quelqu'un aurait-il une idée, merci.
Code : Sélectionner tout - Visualiser dans une fenêtre à part \Test.exe s'est terminé avec le code -1073741515
Partager