Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Trouble linking to Qt libraries statically.
I found that I can link mingw runtimes statically using
QMAKE_LFLAGS = -static -static-libgcc
This works fine.
I also found that people in the past have been able to link to Qt libraries statically using
CONFIG += static
CONFIG += staticlib
This does not work for me, I still get the popup saying cannot find (QtCore.dll) or some other dll from Qt. When I run the exe directly from the build folder.
I am using Qt 5.0.2 32bit mingw SDK. Windows 7 64bit os. How can I get it to link qt statically.
I am aware of the licensing issues. This is open source application so I am covered by GPL.
did you also compile Qt itself as static lib?
I looked in the lib folder of the sdk and there was libxxxx.a for each qt dll. And the sizes are similar for example qtcore.dll is 4mb, and libqtcore.a is 3.9mb isn't this a statically built Qt?
only if you built Qt twice ... once with dynamic and once with static linking...
SInce you have DLLs in there too.
Whats the content of the file: <qt-dir>/qtbase/config.summary
I never built qt I'm using the sdk, and it appears to have the pre built .a files.
qxoz last edited by
[quote author="pwnstar23" date="1370554593"]I never built qt I'm using the sdk, and it appears to have the pre built .a files.[/quote]
You need build Qt staticaly, .a files in prebuild binaries are for linking with dinamic libs. "Take a look":http://qt-project.org/wiki/How_to_build_a_static_Qt_version_for_Windows_with_gcc.