Qt static build windows msvc

Статическая линковка библиотек Qt 5.x (MinGW) под Windows

В данной статье я опишу как сделать отдельный комплект со статической линковкой библиотек Qt5. Если другими словами, мы сможем собирать проект в один исполняемый файл без Qt *.dll.

Подготовка

Начнем

Сборка комплекта

  • Создаем резервную копию qmake.conf, он находится в «Qt5.5.0\5.5\mingw492_32\mkspecs\win32-g++»
  • Делаем изменения в qmake.conf
  • Создаем резервную копию исходников Qt, они находятся в «Qt5.5.0\5.5\Src»
  • Теперь запускаем терминал Qt — Qt 5.5 for Desktop (MinGW 4.9.2 32 bit), он находится
    в «Все программы -> Qt5.5.0 -> 5.5 -> MinGW 4.9.2 (32-bit)» или же полным путем «%appdata%\Microsoft\Windows\Start Menu\Programs\Qt 5.5.0\5.5\MinGW 4.9.2 (32-bit)«
  • Переходим в директорию с исходниками Qt, вводим команду
  • Конфигурируем этап установки, вводя команду, где путь после -prefix, местоположение комплекта сборки
  • По завершению конфигурирования, начинаем компиляцию исходников Qt, командой

После компиляции, будет несколько ошибок, не обращаем на них внимание, они никак не скажутся на нашей сборке.
Копируем файлы в указанный нами каталог на этапе конфигурирования, командой

После копирования, так же будет несколько ошибок, не обращаем на них внимание.

  • Теперь восстанавливаем резервные копии исходников Qt и qmake.conf
  • Добавляем статичный комплект в Qt Creator

    • Запускаем Qt Creator
    • Открываем «Инструменты -> Параметры..»
    • Далее переходим «Сборка и запуск -> Qt Versions»
    • Жмем добавить и выбираем qmake.exe, точнее «X:\Qt\Qt5.5.0_Static\bin\qmake.exe»
    • Переходим во вкладку «Комплекты»
    • Жмем добавить
    • Пишем название нашего комплекта «Qt 5.5.0 Static MinGW 32», в профиле Qt указываем наш статичный профиль, который добавили в Qt Versions, так же указываем версию нашего компилятора и отладчика(MinGW)
    • Все, мы добавили статичный комплект в Qt Creator

    Примечание: в статический комплект не будут включены библиотеки gcc, что бы они так же собирались в исполняемый файл, надо прописать в .pro/.pri

    Спасибо за внимание!

    Данная статья не подлежит комментированию, поскольку её автор ещё не является полноправным участником сообщества. Вы сможете связаться с автором только после того, как он получит приглашение от кого-либо из участников сообщества. До этого момента его username будет скрыт псевдонимом.

    rajendrant / qt_static_build

    ###############################################################################
    # Qt 4.8.5 static build with VS 2012 express
    ###############################################################################
    REM http://qt-project.org/doc/qt-4.8/configure-options.html
    REM QMAKE_CFLAGS_RELEASE = -Ox -Os -GL -MD
    CALL «C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat» x64
    configure -release -opensource -static -ltcg -platform win32-msvc2012 -nomake examples -nomake demos -no-accessibility -no-sql-sqlite -no-qt3support -no-opengl -no-openvg -no-gif -no-libmng -no-libtiff -no-openssl -no-phonon -no-phonon-backend -no-multimedia -no-audio-backend -no-webkit -no-script -no-scripttools -no-declarative -no-declarative-debug -no-style-motif -no-style-cde -no-style-cleanlooks -no-style-plastique
    nmake
    ###############################################################################
    # Qt 5.5.1 static build with VS 2015 Community edition
    ###############################################################################
    REM http://doc.qt.io/qt-5/configure-options.html
    REM qtbase\mkspecs\common\msvc-desktop.conf
    REM QMAKE_CFLAGS_RELEASE = -Ox -Os -GL -MD
    CALL «C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat» x64
    cd D:\Qt\qt-5.5.1-x64-static\qtbase
    configure -release -opensource -confirm-license -static -ltcg -platform win32-msvc2015 -nomake examples -nomake tests -no-sql-sqlite -no-opengl -no-openvg -no-gif -no-openssl -no-audio-backend
    nmake
    REM nmake confclean
    ###############################################################################
    # QuTTY 64 bit build
    ###############################################################################
    CALL «C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat» x64
    cd d:\Qt\tmp
    rmdir /S /Q qutty
    git clone https://github.com/rajendrant/qutty
    cd qutty
    D:\Qt\qt-5.5.1-x64-static\qtbase\bin\qmake.exe QuTTY.pro -spec win32-msvc2015
    nmake
    copy release\QuTTY.exe ..\..\QuTTY-x64.exe
    pause
    ###############################################################################
    # QuTTY 32 bit build
    ###############################################################################
    CALL «C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat» x86
    cd d:\Qt\tmp
    rmdir /S /Q qutty
    git clone https://github.com/rajendrant/qutty
    cd qutty
    D:\Qt\qt-5.5.1-x64-static\qtbase\bin\qmake.exe QuTTY.pro -spec win32-msvc2015
    nmake
    copy release\QuTTY.exe ..\..
    REM upx -9 QuTTY.exe
    pause

    You can’t perform that action at this time.

    You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.

    Building Qt Desktop for Windows with MSVC

    En Ar Bg De El Es Fa Fi Fr Hi Hu It Ja Kn Ko Ms Nl Pl Pt Ru Sq Th Tr Uk Zh

    IMPORTANT: The content of this page is outdated. Reason: This refers to an old version of Qt and the links are no longer valid. Use the Qt documentation on building instead.
    If you have checked or updated this page and found the content to be suitable, please remove this notice.

    Contents

    Required SDKs and tools

    Here are the tools required to build a Qt Shared or a Qt Static library. First, please, download and install :

    1. Qt source code (I think you know where to find it :)) 2. On machines not having a previous Qt version already installed you need to install also Perl (e.g. ActivePerl ) prior to configure. Otherwise you may receive following error message at the end of configure: > Perl not found in environment — cannot run syncqt. 3. Microsoft Platform SDK (most recent at time of last wiki edit is Microsoft Windows 7.1 SDK.). The SDK includes the Microsoft Visual C++ compilers and debugging tools. You can in addition install Visual Studio Express if you like the IDE (not required!). 4. KB2485545 or Service Pack 1 are required for MSVC 2010 when building a 64bit library on intel x86 based CPUs. They fix a bug in the MSVC2010 compiler, and without it you will experience crashes when running 64bit binaries. 5. OpenSSL libraries or source code (if you want to build it yourself)

    For Shared (if you want Phonon support) also required

    Ok, all done but… If you decided to build OpenSSL yourself (really, I recommend you) it is also required

    Installation

    At first I recommend you to install all packages into one directory (for example _C:):

    • C: (for Visual C+)
    • C:7.1 SDK (for platform SDK)
    • C: (for OpenSSL library or unpack source code anywhere for build)

    It is not required to install examples, demos, docs, libraries not for target architecture e.g. 😉

    Environment setup

    It looks good to have a script to set up the environment instead of setting it all using system PATH variable:

    set DEV=C:set QTDIR=%DEV%set PATH=%SystemRoot%;%SystemRoot%32;%QTDIR%

    echo Setting OpenSSL Env. set OPENSSL=%DEV%set PATH=%OPENSSL%;%PATH% set LIB=%OPENSSL%set INCLUDE=%OPENSSL%

    echo Setting NASM Env. set PATH=%DEV%;%PATH%

    echo Setting DirectX Env. set LIB=%DEV%SDK\Lib\x86;%LIB% set INCLUDE=%DEV%SDK\Include;%INCLUDE%

    echo Setting Windows SDK Env. set WindowsSdkDir=%DEV%7.1 SDK set PATH=%WindowsSdkDir%;%PATH% set LIB=%WindowsSdkDir%;%LIB% set INCLUDE=%WindowsSdkDir%;%INCLUDE% set TARGET_CPU=x86

    echo Setting MSVC2010 Env. set VSINSTALLDIR=%DEV%set VCINSTALLDIR=%DEV%set DevEnvDir=%VSINSTALLDIR%7\IDE set PATH=%VCINSTALLDIR%;%VSINSTALLDIR%7\Tools;%VSINSTALLDIR%7\IDE;%VCINSTALLDIR%;%PATH% set INCLUDE=%VCINSTALLDIR%;%INCLUDE% set LIB=%VCINSTALLDIR%;%LIB% set LIBPATH=%VCINSTALLDIR%

    echo Setting Framework Env. set FrameworkVersion=v4.0.30319 set Framework35Version=v3.5 set FrameworkDir=%SystemRoot%.NET\Framework set LIBPATH=%FrameworkDir%amp;#37;FrameworkVersion%;%FrameworkDir%amp;#37;Framework35Version%;%LIBPATH% set PATH=%LIBPATH%;%PATH%

    title Qt Framework 4.7.1 Development Kit.

    This file is .bat (or.cmd) script. Just modify and save it for your environment. I set it up from tool’s (MSVC, SDKs) prompts.

    You can add it to start menu or make a label (change script address at label preferences to «cmd /k path/to/setqtenv.cmd«).

    What we have

    At my computer I have installed MSVC+ 2010 Express Edition to C:, Windows 7.1 SDK C:7.1 SDK, DirectX SDK C:SDK, Perl C: (impossible to change), NASM unpacked to C:, Qt Desktop (4.7.1) source code (from qt-everywhere-opensource-src-4.7.1.tar.gz) unpacked to C: and OpenSSL source code unpacked to C:–1.0.0c

    «Static» tips

    Before you start to build a static Qt Desktop library, you must know that for now you will have a dependence with MSVC Redistributable. To escape this you must replace -MD (d) build flag with -MT (d) (I will not recommend you use it, because it can cause runtime errors, etc. For example with this configuration I cannot start QtDesigner app. The reason is unknown.)

    It’s available as both Static and Shared builds.

    Building OpenSSL

    At first, open your new Qt prompt, cd to your OpenSSL source directory and setup (if not set) Perl bin directory path (and check it?):

    > cd openssl-* > set PATH=C:;%PATH% > echo %PATH%

    Something like this:

    If all is ok, we can continue…

    Configuring and preparing OpenSSL (copy-paste it, here is underscore symbols):

    If you have NASM:

    > perl Configure VC-WIN32 —prefix=C: > ms\do_nasm

    > perl Configure VC-WIN32 no-asm —prefix=C: > ms\do_ms

    Here we set up compiler and destination directory.

    Now open ms\ntdll.mak (for Static — ms\nt.mak) file and replace at LFLAGS /debug with /release.

    For Static build flag -MT is applied by default (look at «Static» tips). For shared -MD is used (change CFLAG’s at ms\ntdll.mak from /MD to /MT if required for you).

    Ok, building, testing and «installing»:

    > nmake -f ms\ntdll.mak > nmake -f ms\ntdll.mak test > nmake -f ms\ntdll.mak install

    > nmake -f ms\nt.mak > nmake -f ms\nt.mak test > nmake -f ms\nt.mak install

    Ready. Now you can remove your OpenSSL source code (C:–1.0.0c here, on screenshot) directory and Perl installation. They are no longer required.

    Configuring Qt Desktop

    There are 2 steps:

    1. Check/Change build flags
    2. Configure

    Note: MSVC supports build with multiple processes. Really. You can add -MP[processMax] flag. Details here.

    For first step (are you really sure with «Static» tips?) we are going to %QTDIR%32-msvc2010 (I know that you know that real path is C:32-msvc2010 and if you have different version of MSVC it will be different spec directory ;)). Here we are interested in the qmake.conf configuration file.

    Edit QMAKE_CFLAGS_RELEASE, QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO & QMAKE_CFLAGS_DEBUG variables. For example:

    QMAKE_CFLAGS_RELEASE = -O2 -MD -MP2 QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MD -Zi -MP2 QMAKE_CFLAGS_DEBUG = -Zi -MDd -MP2

    Next — configuring. My configuration (shared) is:

    > configure -release -opensource -shared -ltcg -no-fast -exceptions -accessibility -stl -qt-sql-sqlite -no-qt3support -no-openvg -platform win32-msvc2010 -graphicssystem raster -qt-zlib -qt-gif -qt-libpng -qt-libmng -qt-libtiff -qt-libjpeg -no-dsp -no-vcproj -incredibuild-xge -plugin-manifests -qmake -process -rtti -mmx –3dnow -sse -sse2 -openssl -no-dbus -phonon -phonon-backend -multimedia -audio-backend -webkit -script -scripttools -declarative -arch windows -qt-style-windows -qt-style-windowsxp -qt-style-windowsvista -no-style-plastique -no-style-cleanlooks -no-style-motif -no-style-cde -no-style-windowsce -no-style-windowsmobile -no-style-s60 -native-gestures

    As you see, I do not want to build Qt3 support module, some styles, using image libs from Qt source, some additional instructions sets are enabled and some another stuff.

    Ok, let’s configure… Accepting license… Please, wait… (building qmake now) 🙂

    All the project’s files are read and now we able to build libs, tools, examples, etc. Just nmake it to build all. Also we are able to make only libs (nmake sub-src), tools (nmake sub-tools, but after libs)…

    Recommendations

    Copy (or move) OpenSSL libraries (*.dll) from %QTDIR% directory to Qt bin directory and add %QTDIR% to system %PATH% variable.

    > move OpenSSL\bin.dll Qt\bin

    Reduce used HDD space

    Attention! This operations removes debugging information! (if you set release-and-debug)

    Just at %QTDIR% run nmake clean to delete all tmp objects, etc. Then rebuild translations (go to %QTDIR% and run nmake). And remove libraries (.dll) from %QTDIR%.

    > cd Qt > nmake clean > cd translations > nmake > cd ..> del.dll

    Building a static Qt for Windows using MinGW

    En Ar Bg De El Es Fa Fi Fr Hi Hu It Ja Kn Ko Ms Nl Pl Pt Ru Sq Th Tr Uk Zh

    Contents

    Why a static Qt?

    On Windows, the pre-built environments from qt.io are dynamically linked. This means that your Qt application dynamically references the Qt DLL’s which are installed with the pre-built environment.

    This is probably the preferred environment for developing and debugging since everything is there and ready to use. However, when it comes to deploying an application on systems without pre-installed Qt environments, it becomes complicated. There are several DLL’s to deploy with the application. Even using the classical DLL Dependency Walker tool, you cannot find all required DLL’s since some of them are dynamically loaded at execution. So, when the application is ready to deploy, it is easier to build a static version of it. But building a static version of the application requires a static version of the Qt environment in addition to the pre-built dynamic Qt environment.

    This article describes an automated way of downloading, building and installing a static Qt development environment using a Windows PowerShell script.

    Note that building and installing a static version of Qt on Windows was somewhat problematic up to Qt 4. But Qt 5 has now a much better support for static builds on Windows and this article takes advantage of that.

    MinGW vs. MSVC

    On Windows, two pre-built environments can be downloaded: one using MinGW and one using Microsoft Visual Studio. The two environments are incompatible and cannot be mixed. You have to choose one.

    This article describes how to build a static version of Qt in a MinGW environment. If you need a static Qt for MSVC, you may probably find some ideas here but there is definitely some extra work.

    Target environment

    When you develop Qt applications on Windows and need to deploy them later on «general purpose» Windows machines, the recommended Qt environment contains two distinct builds of the same version of Qt:

    • A dynamic version, installed in C:\Qt from a pre-built package.
    • A static version, installed in C:\Qt\Static using the procedure which is described in this article.

    The pre-built dynamic environment shall be used for development and debugging. In addition to the Qt command line tools (qmake, moc, uic, lupdate, lrelease, etc.), it contains the high-level GUI tools such as Qt Creator, Assistant, Linguist, etc. The installation is straightforward, everything is here, well integrated, working like a charm.

    The static environment shall be used to release the deployment version of the application, after it has been fully developed and debugged using the dynamic environment. The static environment contains only the Qt command line tools. There are at least two reasons for not building static versions of the GUI tools. First, releasing a new version of an application is typically a task that you automate using a script and there is no need for GUI tools at this stage. Second, it is probably impossible to build a static version of Qt Creator because of the lack of support for plugins in a static environment.

    Restrictions in a static environment

    Although building a static version of your application makes it easier to deploy, there are some restrictions in a static environment. Be sure to check that your application complies with these constraints before going further.

    1. There are licensing issues in distributing applications embedding Qt code in a static link. See here and here for more details. While you are probably safe if your application is distributed according to the terms of a recognized free and open-source license, you should definitely check the licensing issue for proprietary or closed-source applications.
    2. The application cannot use a dynamic modular approach using plugins. But you cannot both ask for a static environment and for a dynamic loading of your own DLL’s.

    Also note the following points:

    • The static executable file of the application is bigger than the dynamic one since all used Qt code is copied into the executable. However, if your application has only one executable, the total deployed size is smaller since only the Qt code which is actually used is linked. When deploying a dynamic version of the application, you have to install all required Qt DLL’s with the application and the overall size of all these DLL’s is larger than the static application.
    • A Qt static build means that no Qt or MinGW DLL’s are used. However, the static executable file of the application still references the Windows DLL’s such as kernel32.dll or user32.dll. These DLL’s, however, are installed with Windows and do not need to be deployed with the application.

    Prerequisites

    Dynamic pre-built Qt environment

    Install the dynamic pre-built package from qt.io. Select the package named «Qt 5.5.0 for Windows 32-bit (MinGW 4.9.2, 959 MB)». The exact name and version may vary. You can also browse the tree of installation packages.

    Preferably plan the installation of the same version of Qt for the dynamic and static builds. This is not a strict requirement but it is a safe configuration. At the time of writing of this article, the latest Qt version is 5.5.0.

    During installation, select the default installation location (C:). Be sure to add the MinGW environment in the installation (selectable in the «Tools» branch of the installation options).

    If you have a separated MinGW environment that you prefer to use and do not install the one from the Qt package installer, be sure to specify the option -MingwDir in the static build script (see below).

    Windows PowerShell

    The script which builds the static Qt environment is a PowerShell script.

    Note: at least one user has experienced problems with this script. For a discussion, and workaround, see this forum topic.

    The PowerShell version 3.0 or higher is required. PowerShell 3.0 comes with Windows 8 but it can be installed on Windows 7 as well from Microsoft download. It is probably impossible to install PowerShell 3.0 on Windows XP or Vista. This article consequently applies to Windows 7 and higher only.

    The build script also requires 7-Zip to uncompress the downloaded Qt source code. Be sure to install it first.

    Building the Qt static environment

    Download and run, all done

    The above link fetches the script directly from the git repository of a small open-source project named QtlMovie. You may want to have a look at the various build scripts in this project for sample application builds and installations.

    Prior to executing this script, you may have to make one or two changes:

    1. the link «http://download.qt-project.org/official_releases/qt/5.3/5.3.0/single/qt-everywhere-opensource-src-5.3.0.7z» is an outdated release of Qt. You’ll have to change this to the current version (unless you explicitly supply a path using the QtSrcUrl parameter.
    2. The path that reads » C:\Qt\*\Tools\mingw*\bin\gcc.exe» needed to be changed to » C:\Qt\Tools\mingw*\bin\gcc.exe» on my (Windows 10) system.

    Execute the script.

    The windows-build-qt-static.ps1 script can be directly invoked from the Windows Explorer if you are ok with the default parameter values (see below). If you are not familiar with PowerShell, simply right-click on the file and select «Run with PowerShell».

    The script performs the following steps:

    1. Download Qt source code.
    2. Build a static version of Qt using the MinGW compiler in the pre-built dynamic environment. It builds the libraries and the command line tools (qmake, moc, uic, lupdate, lrelease, etc.)
    3. Install the static version of Qt in C:\Qt\Static by default.

    The execution of this script may take a couple of hours to complete, depending on your processing power. So you have to be patient. Qt is a complex framework with a very large amount of code.

    Command line syntax

    Alternatively, you can invoke the script from the PowerShell prompt using the following syntax:

    windows-build-qt-static.ps1 [-QtSrcUrl url] [-QtStaticDir directory] [-QtVersion string] [-MingwDir directory] [-NoPause]

    Command line parameters

    Specify the URL of the Qt source file archive. By default, the latest identified version is hardcoded ([1] at the time of this article was edited).

    Instead of using the parameter on the command line, you may want to modify the default value in the script using another URL / version. Update the following line:

    Specify the root directory where the static versions of Qt are installed. By default: C:.

    Specify the Qt version. By default, the script tries to extract the version number from the Qt source file name. Usually, this is sufficient, the script will find «5.5.0» or «5.0.0-rc1» for instance. If the naming scheme of the Qt source file changes one day, you may need to specify an explicit value to this parameter.

    Specify the root directory of the MinGW environment. By default, use the version which was installed by the prebuilt Qt environment.

    When the prebuilt environment for Qt 5.5.0 is installed for instance, the script locates MinGW in C:\5.5.0\Tools\mingw492_32. If you chose not to install MinGW as part of the prebuilt environment for Qt, you have to specify the root directory of your MinGW installation.

    Do not wait for the user to press enter at the end of execution. By default, the scripts executes a pause instruction at the end of execution, which is useful when the script was run from the Windows Explorer.

    Using the Qt static environment

    Command line

    This section describes how to use the static Qt environment from the command line, either the traditional Windows command shell (cmd.exe) or the Windows PowerShell.

    Simply add the bin subdirectory of the static Qt environment in front of the Path environment variable. For Qt 5.5.0, this is C:\Qt\Static\5.5.0\bin.

    Do not forget to also include the MinGW environment in the path. With the dynamic pre-built Qt environment, you may want to add Qt Creator also.

    The following commands summarize the command line setups for the various environments.

    Dynamic pre-built Qt with the traditional Windows command shell: set Path=C:\Qt\Qt5.5.0\5.5.0\mingw492_32\bin;C:\Qt\Qt5.5.0\Tools\mingw492_32\bin;C:\Qt\Qt5.5.0\Tools\QtCreator\bin;C:32;C:

    Dynamic pre-built Qt with the Windows PowerShell: $env:Path=C:\Qt\5.5.0\5.5.0\mingw492_32\bin;C:\Qt\Qt5.5.0\Tools\mingw492_32\bin;C:\Qt\5.5.0\Tools\QtCreator\bin;C:\32;C:

    Static Qt build with the traditional Windows command shell: set Path=C:\2.0\bin;C:\Qt\Qt5.5.0\Tools\mingw492_32\bin;C:\32;C:

    Static Qt build with the Windows PowerShell: $env:Path=C:\Qt\.5.0\bin;C:\Qt\Qt5.5.0\Tools\mingw492_32\bin;C:\32;C:

    Using the Qt static environment with Qt Creator

    This section describes how to use the static Qt environment from Qt Creator. Note that Qt Creator itself is part of the dynamic pre-built environment. By default, it builds the applications for this dynamic environment. But it is possible to configure it to additionally use the static Qt environment.

    The following description is based on a Qt 5.5.0 / Qt Creator 3.4.2 installation, without additional customization of Qt Creator. Change the version numbers to adapt to your configuration.

    Qt Creator setup

    Open the Qt Creator options edit box (menu «Tools» then «Options…»). Select «Build & Run».

    Go to tab «Qt Versions». In the «qmake location» table, there must be an «Auto-detected» part and a «Manual» part. In the «Auto-detected» part, there should be one line named «Qt 5.5.0 MinGW 32bit C:\Qt\Qt5.5.0\5.5\mingw492_32\bin\qmake.exe». The «Manual» part is initially empty.

    Click «Add», browse to C:\Qt\Qt5.5.0\bin and select «qmake.exe». The version name is automatically set to «Qt 5.5.0 (5.5.0)». You should set a more meaningful name such as «Qt 5.5.0 MinGW Static 32bit»

    Then go to tab «Kits». Again, there must be an «Auto-detected» part and an initially empty «Manual» part. Click «Add». Set a meaningful name such as «Desktop Qt 5.5.0 MinGW Static 32bit». In the «Qt version» field, select your static environment, named «Qt 5.5.0 MinGW Static 32bit» if you followed the above advice.

    Then click «OK» to terminate the options setup.

    Project setup

    In each project you want to deploy with a static build, edit the project setup (select «Projects» in the left vertical pane).

    Click «Add Kit» in the upper left corner and select your static kit, named «Desktop Qt 5.5.0 MinGW Static 32bit» if you followed the above advice.

    The new kit for your project is configured. Note that, by default, there are distinct build directories for the dynamic and static versions of your project.

    Now you can build your application in any combination of static vs. dynamic and release vs. debug. In the bottom part of the left pane, the project selector (the computer icon with the name of your project and either «Release» or «Debug») lets you select the combination you want.

    Note that it is recommended to build only release versions of the application with the static environment. Avoid building a debug version of the application with the static environment. There are several reasons for that:

    • The recommended environment for the development, debug and test phase is the pre-built dynamic environment, not the static one.
    • The size of a static application in debug mode is insanely huge. For a given application, the following sizes have been observed for the application executable file:
      • Dynamic + Release: 1 MB
      • Dynamic + Debug: 33 MB
      • Static + Release: 16 MB
      • Static + Debug: 297 MB
    Читайте также:  Windows hotkeys свернуть одно окно
    Оцените статью