Bonjour à tous,
J'entreprends un petit projet Qt et, pour cela, j'ai besoin d'une library que j'ai utilisé précédemment dans un projet Visual Studio.
Le soucis : bien que je n'ai aucun problème à utiliser une library, j'ai du mal à en comprendre le fonctionnement et l'architecture (ce que cela permet, quels fichiers relier à Qt, .lib et .dll, etc...)
On trouve beaucoup de docs quant à comment créer ou ajouter une library, mais assez peu lorsqu'il s'agit de comprendre entièrement le fonctionnement et l'utilité de chaque fichier.
Aussi, j'ai essayé avec le "add library" proposé par l'IDE.
Rajoutant à mon .pro les lignes :
Code Qt-pro : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../Desktop/LLA/packages/lib/Win32/release/ -lliblogicalaccess else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../Desktop/LLA/packages/lib/Win32/debug/ -lliblogicalaccess INCLUDEPATH += $$PWD/../../Desktop/LLA/packages/include DEPENDPATH += $$PWD/../../Desktop/LLA/packages/include
Cependant, j'ai eu une erreur comme quoi le fichier .lib n'était pas trouvé.
En faisant mes recherches, j'ai donc bidouillé "à la main" le .pro en rajoutant la ligne suivante :
Code Qt-pro : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 PRE_TARGETDEPS += -L$$PWD/../../Desktop/LLA/packages/lib/Win32/debug/liblogicalaccess.lib
J'ai désormais l'erreur "multiple target patterns. Stop." dans le Makefile.Debug et je ne me sort pas de ce problème. L'erreur a lieu à la ligne 86, au niveau du "&DESTDIR(TARGET): -LC: ...", vers la fin du Makefile que j'ai posté ci-dessous.
J'ai tout d'abord regardé si il n'y avait pas un autre DESTDIR quelque part qui s'interposait, j'ai essayé de le refaire à la main ou de mettre en commentaires certaines parties qui semblaient similaires, mais, j'ai du mal à comprendre le fonctionnement du .pro et la réel signification de tout ces "$Mots clés"...
Si quelqu'un a une idée ou même simplement des éclaircissements quant aux library en général.
Ci-dessous mon .pro en entier et le fameux Makefile.Debug (une bonne partie) :
.pro
Code Qt-pro : 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
40
41
42
43
44
45
46
47
48 QT += quick CONFIG += c++11 # The following define makes your compiler emit warnings if you use # any feature of Qt which as been marked deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS # You can also make your code fail to compile if you use deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 SOURCES += main.cpp \ backend.cpp \ comboboxmodel.cpp \ cardinformation.cpp \ cardstructure.cpp RESOURCES += qml.qrc # Additional import path used to resolve QML modules in Qt Creator's code model QML_IMPORT_PATH = # Additional import path used to resolve QML modules just for Qt Quick Designer QML_DESIGNER_IMPORT_PATH = # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target HEADERS += \ backend.h \ comboboxmodel.h \ cardinformation.h \ cardstructure.h win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../Desktop/LLA/packages/lib/Win32/release/ -lliblogicalaccess else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../Desktop/LLA/packages/lib/Win32/debug/ -lliblogicalaccess INCLUDEPATH += $$PWD/../../Desktop/LLA/packages/include DEPENDPATH += $$PWD/../../Desktop/LLA/packages/include PRE_TARGETDEPS += -L$$PWD/../../Desktop/LLA/packages/lib/Win32/debug/liblogicalaccess.lib
Makefile.Debug
Merci d'avance aux courageux qui se pencheront sur le sujet
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93 ############################################################################# # Makefile for building: MRCFinal # Generated by qmake (3.1) (Qt 5.9.2) # Project: ..\MRCFinal\MRCFinal.pro # Template: app ############################################################################# MAKEFILE = Makefile.Debug ####### Compiler, tools and options CC = gcc CXX = g++ DEFINES = -DUNICODE -D_UNICODE -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN CFLAGS = -fno-keep-inline-dllexport -g -Wextra -Wall -W $(DEFINES) CXXFLAGS = -fno-keep-inline-dllexport -g -std=gnu++11 -Wextra -Wall -W -fexceptions -mthreads $(DEFINES) INCPATH = -I..\MRCFinal -I. -I..\..\Desktop\LLA\packages\include -I..\..\..\..\Qt\5.9.2\mingw53_32\include -I..\..\..\..\Qt\5.9.2\mingw53_32\include\QtQuick -I..\..\..\..\Qt\5.9.2\mingw53_32\include\QtGui -I..\..\..\..\Qt\5.9.2\mingw53_32\include\QtANGLE -I..\..\..\..\Qt\5.9.2\mingw53_32\include\QtQml -I..\..\..\..\Qt\5.9.2\mingw53_32\include\QtNetwork -I..\..\..\..\Qt\5.9.2\mingw53_32\include\QtCore -Idebug -I..\..\..\..\Qt\5.9.2\mingw53_32\mkspecs\win32-g++ LINKER = g++ LFLAGS = -Wl,-subsystem,windows -mthreads LIBS = -lmingw32 -LC:\Qt\5.9.2\mingw53_32\lib C:\Qt\5.9.2\mingw53_32\lib\libqtmaind.a -LC:\utils\my_sql\my_sql\lib -LC:\utils\postgresql\pgsql\lib -lshell32 -LC:\Users\Simon\Desktop\LLA\packages\lib\Win32\debug -lliblogicalaccess C:\Qt\5.9.2\mingw53_32\lib\libQt5Quickd.a C:\Qt\5.9.2\mingw53_32\lib\libQt5Guid.a C:\Qt\5.9.2\mingw53_32\lib\libQt5Qmld.a C:\Qt\5.9.2\mingw53_32\lib\libQt5Networkd.a C:\Qt\5.9.2\mingw53_32\lib\libQt5Cored.a QMAKE = C:\Qt\5.9.2\mingw53_32\bin\qmake.exe IDC = idc IDL = midl ZIP = zip -r -9 DEF_FILE = RES_FILE = COPY = copy /y SED = $(QMAKE) -install sed COPY_FILE = copy /y COPY_DIR = xcopy /s /q /y /i DEL_FILE = del DEL_DIR = rmdir MOVE = move CHK_DIR_EXISTS= if not exist MKDIR = mkdir INSTALL_FILE = copy /y INSTALL_PROGRAM = copy /y INSTALL_DIR = xcopy /s /q /y /i QINSTALL = C:\Qt\5.9.2\mingw53_32\bin\qmake.exe -install qinstall QINSTALL_PROGRAM = C:\Qt\5.9.2\mingw53_32\bin\qmake.exe -install qinstall -exe ####### Output directory OBJECTS_DIR = debug ####### Files SOURCES = ..\MRCFinal\main.cpp \ ..\MRCFinal\backend.cpp \ ..\MRCFinal\comboboxmodel.cpp \ ..\MRCFinal\cardinformation.cpp \ ..\MRCFinal\cardstructure.cpp debug\qrc_qml.cpp \ debug\moc_backend.cpp \ debug\moc_comboboxmodel.cpp \ debug\moc_cardinformation.cpp \ debug\moc_cardstructure.cpp OBJECTS = debug/main.o \ debug/backend.o \ debug/comboboxmodel.o \ debug/cardinformation.o \ debug/cardstructure.o \ debug/qrc_qml.o \ debug/moc_backend.o \ debug/moc_comboboxmodel.o \ debug/moc_cardinformation.o \ debug/moc_cardstructure.o DIST = ..\MRCFinal\backend.h \ ..\MRCFinal\comboboxmodel.h \ ..\MRCFinal\cardinformation.h \ ..\MRCFinal\cardstructure.h ..\MRCFinal\main.cpp \ ..\MRCFinal\backend.cpp \ ..\MRCFinal\comboboxmodel.cpp \ ..\MRCFinal\cardinformation.cpp \ ..\MRCFinal\cardstructure.cpp QMAKE_TARGET = MRCFinal DESTDIR = debug\ #avoid trailing-slash linebreak TARGET = MRCFinal.exe DESTDIR_TARGET = debug\MRCFinal.exe ####### Build rules first: all all: Makefile.Debug $(DESTDIR_TARGET) $(DESTDIR_TARGET): -LC:/Users/Simon/Documents/MRCFinal/../../Desktop/LLA/packages/lib/Win32/debug/liblogicalaccess.lib $(OBJECTS) $(LINKER) $(LFLAGS) -o $(DESTDIR_TARGET) object_script.MRCFinal.Debug $(LIBS) qmake: FORCE @$(QMAKE) -o Makefile.Debug ..\MRCFinal\MRCFinal.pro -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug" qmake_all: FORCE
Partager