Static compile in Qt 5.5 (msvc2013)



  • Hi everybody,
    I know my question is duplicate but I so confused. I am searching some hours but can not solve my problem. :(

    I installed Qt 5.5.0 in windows. 32 and 64 bit version of Qt. My compiler is Visual Studio 2013.
    I want to compile my projects statically (no need to set dlls, etc beside the exe file) (Only for release output not debug ouptut)

    Can you guide me step by step?
    Thanks a lot.


  • Lifetime Qt Champion

    Hi,

    The build process is explained here and the static part there in Qt's documentation.

    Be aware of the licensing implication that comes with a static build.



  • @SGaist Hi, Thanks for your reply.

    I followed the first link but have a problem. In step 3, when I create a qt5vars.cmd in desktop and run it, I get this error:

    C:\Windows\System32>C:\Users\---\Desktop\qt5vars.cmd
    
    C:\Windows\System32>REM Set up \Microsoft Visual Studio 2013, where <arch> is \c
     amd64, \c x86, etc.
    The syntax of the command is incorrect.
    
    C:\Windows\System32>CALL "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC
    \vcvarsall.bat" <arch>
    
    C:\Windows\System32>
    

    Here is the content of qt5vars.cmd:

    REM Set up \Microsoft Visual Studio 2013, where <arch> is \c amd64, \c x86, etc.
    CALL "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" <arch>
    SET _ROOT=C:\Qt\Qt5.5.0-32bit\5.5\Src
    SET PATH=%_ROOT%\qtbase\bin;%_ROOT%\gnuwin32\bin;%PATH%
    REM Uncomment the below line when using a git checkout of the source repository
    REM SET PATH=%_ROOT%\qtrepotools\bin;%PATH%
    SET QMAKESPEC=win32-msvc2013
    SET _ROOT=
    

  • Moderators

    In the first line of the script you can see: "where <arch> is \c amd64, \c x86, etc"
    So, <arch> is just a place-holder, you have to replace it with the architecture name, for example x86.
    Like this: CALL "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86



  • Thanks but another problem:
    When I use this command:
    configure -static -release -platform win32-msvc2013
    After accepting of the terms of licence this error occurs:

    Creating qmake...
    execute: File or path is not found (nmake)
    execute: File or path is not found (nmake)
    Cleaning qmake failed, return code -1
    


  • I used Developer Command Prompt for VS2013 instead of Windows Command Prompt
    and now it is working but now a question:
    How can I build my project statically in Qt Creator.
    I added CONFIG += staticbut does not work.


  • Moderators

    @MohammadReza I never used statically built Qt. What exactly does not work? Any error messages?


  • Lifetime Qt Champion

    Did you create a kit that uses your static Qt build ?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.