Hallo,
I have downloaded windows version of qt 5.5.1 - mingw.
In the directory C:/Qt/5.5/mingw492_32/lib there are a lot of .a files, like libQt5Core.a and libQt5Gui.a, so, according to my opinion, I suppose to have the static lib installed. The dll files are located in C:\Qt\5.5\mingw492_32\bin
I create a new "Qt application Project", and I modify .pro as follows:
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = prova
TEMPLATE = app
QMAKE_LFLAGS += -static # try to link the static library
QMAKE_LFLAGS += -Wl,-Map=prova.map # let's produce the map file
SOURCES += main.cpp\
dialog.cpp
HEADERS += dialog.h
FORMS += dialog.ui
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = prova
TEMPLATE = app
QMAKE_LFLAGS += -static # try to link the static library
QMAKE_LFLAGS += -Wl,-Map=prova.map # let's produce the map file
SOURCES += main.cpp\
dialog.cpp
HEADERS += dialog.h
FORMS += dialog.ui
To copy to clipboard, switch view to plain text mode
it seems tha all works. The linker command line is:
g++ -static -Wl,-Map=prova.map -Wl,-subsystem,windows -mthreads -o debug\prova.exe debug/main.o debug/dialog.o debug/moc_dialog.o -lmingw32 -LC:/Qt/5.5/mingw492_32/lib -lqtmaind -lshell32 -lQt5Widgetsd -lQt5Guid -lQt5Cored
g++ -static -Wl,-Map=prova.map -Wl,-subsystem,windows -mthreads -o debug\prova.exe debug/main.o debug/dialog.o debug/moc_dialog.o -lmingw32 -LC:/Qt/5.5/mingw492_32/lib -lqtmaind -lshell32 -lQt5Widgetsd -lQt5Guid -lQt5Cored
To copy to clipboard, switch view to plain text mode
So it seems to use the right directory, and in the map file there are lines like:
.text 0x00402c40 0x8 C:/Qt/5.5/mingw492_32/lib\libQt5Cored.a(d002900.o)
.text 0x00402c48 0x8 C:/Qt/5.5/mingw492_32/lib\libQt5Cored.a(d002895.o)
.text 0x00402c50 0x8 C:/Qt/5.5/mingw492_32/lib\libQt5Cored.a(d002902.o)
.text 0x00402c40 0x8 C:/Qt/5.5/mingw492_32/lib\libQt5Cored.a(d002900.o)
0x00402c40 QObject::timerEvent(QTimerEvent*)
.text 0x00402c48 0x8 C:/Qt/5.5/mingw492_32/lib\libQt5Cored.a(d002895.o)
0x00402c48 QObject::childEvent(QChildEvent*)
.text 0x00402c50 0x8 C:/Qt/5.5/mingw492_32/lib\libQt5Cored.a(d002902.o)
0x00402c50 QObject::customEvent(QEvent*)
To copy to clipboard, switch view to plain text mode
So I thought that the exe was stand alone, but if I try to run it fails because it want libQt5Cored.dll.
Why?
Where am I wrong?
best regards
Max
Bookmarks