Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Static linking in Qt Comercial SDK
I am unable to statically linking my project
i have put CONFIG += static in my .pro file but it doesn't make the linking
and also i didn't successfuly configured the Qt static :(
any help would be apreciated
thank you in advance
You have to compile Qt statically before you can link those libs into your binary.
i have installed Qt Commercial SDK but i opened qt command prompt and it saying
Setting up environment for Qt usage...
Remember to call vcvarsall.bat to complete environment setup!
i cannot run configure :(
I don't know about Commercial SDK, but the old Nokia one had no sources prepared for compilation. You need to separately download commercial Qt source package and compile it on your machine with -static and -no-exceptions.
These are the exact lines I used to compile Qt statically:
./configure -prefix $PWD -nomake demos -nomake examples -nomake tests -release -static -no-exceptions -no-webkit -qt-zlib -qt-libpng -qt-libjpeg -arch x86 -dont-process -no-qt3support
thank you ...and now..how can i build my project from qtCreator statically ?
First, make sure you are using the newly build Qt (Options->Build & Run->Qt Versions, and verify in project options). Then, as you noted:
// your .pro file if you are using qmake
CONFIG += static
Adding the static objects explicitly to LIBS variable is a good idea, too. Here's a link with example: "LINK":http://qt-project.org/doc/qt-4.8/deployment-mac.html#static-linking.
Some people add other things here, too. You need to ask uncle Google for that.
I have this at the effective qmake call :
qmake.exe C:\Users\zolidznake\Desktop\silviu-saved-sources\HardwareInformation\HardwareInformation.pro -r -spec win32-msvc2008 "CONFIG+=debug" "CONFIG+=declarative_debug"
it will take automatically from my .pro file the CONFIG += static ?
thank you for helping ...
IIRC, qmake treats .pro files as more important than the command line arguments, so it should pick it up, yes.
when i try to build i get this :(
:-1: error: LNK1104: cannot open file 'c:\Qt\4.8.3-vs\lib\QtGuid.lib'
Well, is this file available at that location?
in build debug doesn't work...i builded the release ...it works fine...thank you much for your help !
Nice, I'm glad it worked :)