linking static libraries - standalone exe under windows
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:
Code:
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
it seems tha all works. The linker command line is:
Code:
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
So it seems to use the right directory, and in the map file there are lines like:
Code:
.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)
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
Re: linking static libraries - standalone exe under windows
You write that you see libQt5Core.a, but do you have libQt5Cored.a?
Maybe the static build is release only?
Cheers,
_
1 Attachment(s)
Re: linking static libraries - standalone exe under windows
there are both release and debug files:
http://www.qtcentre.org/attachment.p...4&d=1466030737
And I tried both debug and release build. but both seems to require dll's, so are dynamically linked.
where am i wrong
best regards
Max