How to build Qt 5.5 Static Libraries using any Microsoft Visual C++ Compiler

Following steps will help you with building Qt 5.5 Static Libraries with any MSVC Compiler. I have used MSVC2010 in this example but it should be the same for any compiler version from 2005 to 2015 (Visual Studio 2005 (8.0), VC++ 14.0)

Note that building Qt like this will remove all dependencies meaning there won’t be any need for MSVC dlls)

1. Download and extract qt source to this path:


2. Change Environment variables like this:

PATH = C:\Qt\Tools\QtCreator\bin

3. Create folder C:\Qt\5.5\msvc2010_static (if you are not building using msvc2010 then create a folder according to the compiler you are using, like msvc2013 or msvc2008 etc.)

4. goto C:\Qt\5.5\qt-everywhere-opensource-src-5.5.0\qtbase\mkspecs\common
and change msvc-desktop.conf like this (change all MD to MT to remove dependency on msvc dlls)

initial values:


should be changed to:


5. Using MSVC2010 Command Line tools, running as admin, Configure using following command: (first change directory to here using “cd” command : C:\Qt\5.5\qt-everywhere-opensource-src-5.5.0)
(No need to remind that you need to use the Command Line Tools for your own compiler, like MSVC2013 or 2005 or 2008, if you are not using MSVC2010)

configure.bat -static -debug-and-release -prefix "C:\Qt\5.5\msvc2010_static" -platform win32-msvc2010 -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -qt-sql-sqlite -qt-sql-odbc -no-openssl -opensource -confirm-license -make libs -nomake tools -nomake examples -nomake tests

(Notice that the parameter -platform win32-msvc2010 should be set according to the compiler you are using)
(Also note that you can add or remove parts and pieces of the libraries you are building by adding or removing parameters above, for example I always use ODBC so I add -qt-sql-odbc parameter but you might want to remove it if you don’t need it.)

6. Run jom (without any parameters so that the ideal thread count is calculated automatically)

7. run jom install

Ask me if there are any questions regarding the steps, I agree some of them might be a little bit vague to beginners, but I’m ready to help.

Please do not forget that to use Static libraries commercially you need to obtain a proper license from Qt and everything described here is just for educational purposes.

52 Replies to “How to build Qt 5.5 Static Libraries using any Microsoft Visual C++ Compiler”

  1. I have a 64 bit application which i want to compile using qtcreator 5.5.1, so i was trying to compile the qt5.5.1 for msvc2012-x64 configuration. Is there any other way of running my 64bit application by using qt libraries?Like,can i use a qt plugin in msvc2012-x64 config and develop the project from that ide?

  2. can we build qt5.5.1 for x64 msvc-2012? i found that in qt5/qtbase/mkspecs folder there is no win64-msvc2012 folder.can you please tell me ,how to build qt5.5.1 for x64-msvc-2012?

    1. To be honest I’m not so sure. I would recommend you to NOT try to compile something that is not officially supported unless you are really sure what you’re doing.
      The second thing, which is probably a question you should seriously think about, is that why exactly Qt5.5.1 and msvc-2012 x64?!?!

      In any case, if you’re looking for ideas, try to somehow copy and modify existing msvc-2013 x64 mkspecs, since it seems msvc-2013 x64 was provided by Qt:

      Hope this helps.

      1. my requirement is to build a qt project in msvc2012-x64 configuration,because it is a x64 bit application. One of the constraints is i cannot upgrade the visual studio application because of some other project dependencies. Now that i dint find a way to do this, i downloaded the precompiled static libraries of qt 5.5.1 msvc2012-x64 . i have loaded the qt project into msvc2012 ,and trying to link all this precompiled libraries,this msvc2012 has a qt 1.2.5 plugin.Since this version of qt is not installed am not able to do qmake on the project and generate the qmake files and unable to run the project in msvc2012 x64 configuration. Can u please guide me regarding this? Is the steps which I’m doing is not right?

        1. To make it short and simple, you need to have a Qt Kit to build Qt apps. For instance, if you want to build your apps using Qt 5.5.1 msvc2012-x64, then you must have a Qt Kit with the exact same version and so on. If there are prebuilt binaries for it, then you are good to go and you can just use them, otherwise you have to build the Qt Kit by yourself, from scratch. I hope this helps.

  3. hi, i got an error while building, it says compiler internal error c1001 whlie trying to compile qlogging.h any idea?

    1. Can you please make sure your development tools and compilers are installed correctly? This doesn’t look like an issue with Qt or building commands.

  4. please forget and delete my post, I’m so stupid, I forgot to run jom install 🙂
    excuse me please I dint get the line ….

    1. Hi steve, I’m glad you were able to build Qt successfully. Let’s keep your previous comments so if someone else faces the same problem, they will benefit from it 🙂

  5. (sorry for my bad english, I’m not a native speaker)

    Hi, thx for your verry good tutorial, it is realy useful. (!)
    It seems all fine, but theres a little problem…. the folder to where I want to build is empty 🙁
    I don’t know why 🙂
    I done yout tutorial with Windows 10, MSVC2013 and QT 5.6.0.
    I follow your turorial and created an folder “C:QtQt5.6.0msvc2013_static_build” , it really exists.
    Then, I went on, with this command:
    configure.bat -static -debug-and-release -prefix “C:QtQt5.6.0msvc2013_static_build” -platform win32-msvc2013 -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -qt-sql-sqlite -qt-sql-odbc -no-openssl -opensource -confirm-license -make libs -nomake tools -nomake examples -nomake tests

    (I did it two times, to check ist after the first)
    – all looks fine
    then I run “jom”
    after 10 or 15 minutes it fished without any errors.
    these are the last lines:
    cl -c -nologo -Zc:wchar_t -FS -O2 -MT -Zc:strictStrings -D_HAS_EXCEPTIONS=0 -GR -W3 -w34100 -w34189 -w44996 -DUNICODE -DWIN32 -DQT_USE_QSTRINGBUILDER -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_XMLPATTERNS_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DNDEBUG -I. -I….include -I….includeQtXmlPatterns -IC:QtQt5.6.0qt-everywhere-opensource-src-5.6.0qtbaseinclude -IC:QtQt5.6.0qt-everywhere-opensource-src-5.6.0qtbaseincludeQtNetwork -IC:QtQt5.6.0qt-everywhere-opensource-src-5.6.0qtbaseincludeQtCore -I.mocrelease -IC:QtQt5.6.0qt-everywhere-opensource-src-5.6.0qtbasemkspecswin32-msvc2013 -Fo.objrelease @C:UsersPsyborgAppDataLocalTempxmlpatternsvalidator_plugin_import.obj.13588.828.jom
    link /NOLOGO /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO /SUBSYSTEM:CONSOLE “/MANIFESTDEPENDENCY:type=’win32′ name=’Microsoft.Windows.Common-Controls’ version=’′ publicKeyToken=’6595b64144ccf1df’ language=’*’ processorArchitecture=’*'” /MANIFEST:embed /OUT:….binxmlpatternsvalidator.exe @C:UsersPsyborgAppDataLocalTempxmlpatternsvalidator.exe.13588.2094.jom
    link /NOLOGO /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO /SUBSYSTEM:CONSOLE “/MANIFESTDEPENDENCY:type=’win32′ name=’Microsoft.Windows.Common-Controls’ version=’′ publicKeyToken=’6595b64144ccf1df’ language=’*’ processorArchitecture=’*'” /MANIFEST:embed /OUT:….binxmlpatterns.exe @C:UsersPsyborgAppDataLocalTempxmlpatterns.exe.14228.6172.jom

    but now I can’t the Libarys, my static-folder (I wrote above) is empty …

    So what could be wrong?

    1. You can use this link for a complete list of configure parameters and their meanings. Available options for make are “libs, tools, examples, tests”. Libs as it can be inferred from its title enables building of all libraries. You should always include this when you are building from scratch because everything else depends on libs.

  6. Have you ever build Qt with MinGW?? I did it a while ago and wrote an own tutorial, but most of the things i did not understood. I read lots of tutorials and found a way it worked.
    Now i found this: and it’s a bit different from my tutorial:ür-statisches-linken-builden-mingw
    So i tried a combination between my, the newly found and your tutorial to build Qt with MinGW. Currently it builds something but i couldn’t use jom so it’ll take very long. And the newly found tut says that i cannot use make install and before i need to make something with fart.exe.

    I hoped maybe you can write an tutorial about a static Qt build with MinGW, because your tuts are very clear to understand and they work 😀

      1. yes i know about minge32-make. But jom did not work.
        About the wiki article, i found it, but i missed the parts where to edit the files for static build. So i thought maybe it’s not complete or not what i’m looking for. This time i actualy read the text and saw that everything is done with a script. I’d prefere to manuel do the build because there are always some custom options I use (for example the install path,…)

        1. You’re right. I’m also all for manual build and being in control of everything but that does not mean you should invent the wheel you know. You can edit the script to fit your needs. That way you can also reuse it, or share it with us too 🙂

          1. Do you know how to use the Visual Studio debugger within the msvc kit in Qt Creator??

          2. No, you have to download it separately. If you are talking about any kind of internal debugging function in VS, that does not apply to Qt Creator. Note this, debugger is part of SDK (which Qt uses), not VS’s IDE. SDK and IDE are totally separate from each other.

          3. Not sure but even if it’s possible somehow I wouldn’t do that. And I suggest you also just use the recommended debugger.

  7. I have successfully created release build from win32 version. But when I try to change the configuration and create x64 there are number of issues.

    First one I solved, it said something about change the qt version. What I did is, from visual studio menu-> QT5-> Select convert project to QMake project.
    Once I did that there was an entry which says, Change project’s qt version.
    (At this point I had only one option to select.) I selected that. Then the project compiled however there were multiple stupid link errors. Caused absurdly substituting $(QTDIR) with root directory. I solved that too.

    Then there is a linker error,
    “qtmain.lib(qtmain_win.obj) : fatal error LNK1112: module machine type ‘X86’ conflicts with target machine type ‘x64′”

    Now I know this error is caused because of incompatible compiler and lib file architectures. My question is, do I have to rebuild a newer qt version or is there a workaround?

    And, if I create the release project from win32 version will it run on a 64bit machine? (I guess it is. But still want to make sure.)


    1. First of all, I would advice on rebuilding if you are facing the error you just mentioned. Cause even if you are able to complete your build you will have unpredictable stability issues (simply means sudden crashes) because of mixed libraries from different architectures.
      Next, I suggest you should go for the 32-bit version, and also use the lowest possible build (such as MSVC2010) because of the enormous backward-compatibility that it allows.
      Finally, yes, 32-bit version of Qt would work with 64-bit Operating Systems but the opposite is not true.
      Btw, you probably won’t face any issues if you just use the correct compiler version. Would you share your compiler and Qt source version?!

  8. Hi Amin,

    Thank you for your tutorial, it is clear and very helpful.

    However, I have the same problems than Sema. Below is the last part of the console output after executing “jom”. These errors are also showing up after executing “jom install”. I used the same config parameters than provided in this blog. Do you have any idea what can cause these problems.

    My environment is:
    OS = Windows 10, 64-bit

    QT (Online Installation) = 5.5.1 with Creator 3.5.1

    QT Installed Components = QT 5.5 (MinGW 32-bit, msvc2013 32-bit and msvc2013 64-bit)

    QT (Source) = qt-everywhere-opensource-src-5.5.1 (for 64-bit)

    Compiler = MSVC2013 (64-bit) with Visual Studio 2013 (and 2015) installed

    ——————— Console Output errors ——————————————-

    Creating library ….binqmltestrunner.lib and object ….binqmltestrunner.exp
    Qt5Qml.lib(YarrPattern.obj) : error LNK2019: unresolved external symbol “struct JSC::Yarr::CharacterClass * __cdecl JSC::Yarr::newlineCreate(void)” (?newlineCreate@Yarr@JSC@@YAPAUCharacterClass@12@XZ) referenced in function “public: struct JSC::Yarr::CharacterClass * __thiscall JSC::Yarr::YarrPattern::newlineCharacterClass(void)” (?newlineCharacterClass@YarrPattern@Yarr@JSC@@QAEPAUCharacterClass@23@XZ)
    Qt5Qml.lib(YarrInterpreter.obj) : error LNK2001: unresolved external symbol “struct JSC::Yarr::CharacterClass * __cdecl JSC::Yarr::newlineCreate(void)” (?newlineCreate@Yarr@JSC@@YAPAUCharacterClass@12@XZ)
    Qt5Qml.lib(YarrJIT.obj) : error LNK2001: unresolved external symbol “struct JSC::Yarr::CharacterClass * __cdecl JSC::Yarr::newlineCreate(void)” (?newlineCreate@Yarr@JSC@@YAPAUCharacterClass@12@XZ)
    Qt5Qml.lib(YarrPattern.obj) : error LNK2019: unresolved external symbol “struct JSC::Yarr::CharacterClass * __cdecl JSC::Yarr::digitsCreate(void)” (?digitsCreate@Yarr@JSC@@YAPAUCharacterClass@12@XZ) referenced in function “public: struct JSC::Yarr::CharacterClass * __thiscall JSC::Yarr::YarrPattern::digitsCharacterClass(void)” (?digitsCharacterClass@YarrPattern@Yarr@JSC@@QAEPAUCharacterClass@23@XZ)
    Qt5Qml.lib(YarrPattern.obj) : error LNK2019: unresolved external symbol “struct JSC::Yarr::CharacterClass * __cdecl JSC::Yarr::spacesCreate(void)” (?spacesCreate@Yarr@JSC@@YAPAUCharacterClass@12@XZ) referenced in function “public: struct JSC::Yarr::CharacterClass * __thiscall JSC::Yarr::YarrPattern::spacesCharacterClass(void)” (?spacesCharacterClass@YarrPattern@Yarr@JSC@@QAEPAUCharacterClass@23@XZ)
    Qt5Qml.lib(YarrPattern.obj) : error LNK2019: unresolved external symbol “struct JSC::Yarr::CharacterClass * __cdecl JSC::Yarr::wordcharCreate(void)” (?wordcharCreate@Yarr@JSC@@YAPAUCharacterClass@12@XZ) referenced in function “public: struct JSC::Yarr::CharacterClass * __thiscall JSC::Yarr::YarrPattern::wordcharCharacterClass(void)” (?wordcharCharacterClass@YarrPattern@Yarr@JSC@@QAEPAUCharacterClass@23@XZ)
    Qt5Qml.lib(YarrInterpreter.obj) : error LNK2001: unresolved external symbol “struct JSC::Yarr::CharacterClass * __cdecl JSC::Yarr::wordcharCreate(void)” (?wordcharCreate@Yarr@JSC@@YAPAUCharacterClass@12@XZ)
    Qt5Qml.lib(YarrJIT.obj) : error LNK2001: unresolved external symbol “struct JSC::Yarr::CharacterClass * __cdecl JSC::Yarr::wordcharCreate(void)” (?wordcharCreate@Yarr@JSC@@YAPAUCharacterClass@12@XZ)
    Qt5Qml.lib(YarrPattern.obj) : error LNK2019: unresolved external symbol “struct JSC::Yarr::CharacterClass * __cdecl JSC::Yarr::nondigitsCreate(void)” (?nondigitsCreate@Yarr@JSC@@YAPAUCharacterClass@12@XZ) referenced in function “public: struct JSC::Yarr::CharacterClass * __thiscall JSC::Yarr::YarrPattern::nondigitsCharacterClass(void)” (?nondigitsCharacterClass@YarrPattern@Yarr@JSC@@QAEPAUCharacterClass@23@XZ)
    Qt5Qml.lib(YarrPattern.obj) : error LNK2019: unresolved external symbol “struct JSC::Yarr::CharacterClass * __cdecl JSC::Yarr::nonspacesCreate(void)” (?nonspacesCreate@Yarr@JSC@@YAPAUCharacterClass@12@XZ) referenced in function “public: struct JSC::Yarr::CharacterClass * __thiscall JSC::Yarr::YarrPattern::nonspacesCharacterClass(void)” (?nonspacesCharacterClass@YarrPattern@Yarr@JSC@@QAEPAUCharacterClass@23@XZ)
    Qt5Qml.lib(YarrPattern.obj) : error LNK2019: unresolved external symbol “struct JSC::Yarr::CharacterClass * __cdecl JSC::Yarr::nonwordcharCreate(void)” (?nonwordcharCreate@Yarr@JSC@@YAPAUCharacterClass@12@XZ) referenced in function “public: struct JSC::Yarr::CharacterClass * __thiscall JSC::Yarr::YarrPattern::nonwordcharCharacterClass(void)” (?nonwordcharCharacterClass@YarrPattern@Yarr@JSC@@QAEPAUCharacterClass@23@XZ)
    ….binqmltestrunner.exe : fatal error LNK1120: 7 unresolved externals
    jom: C:Qt5.5qt-everywhere-opensource-src-5.5.1qtdeclarativetoolsqmltestrunnerMakefile.Release [….binqmltestrunner.exe] Error 1120
    jom: C:Qt5.5qt-everywhere-opensource-src-5.5.1qtdeclarativetoolsqmltestrunnerMakefile [release] Error 2
    jom: C:Qt5.5qt-everywhere-opensource-src-5.5.1qtdeclarativetoolsMakefile [sub-qmltestrunner-make_first] Error 2
    jom: C:Qt5.5qt-everywhere-opensource-src-5.5.1qtdeclarativeMakefile [sub-tools-make_first] Error 2
    jom: C:Qt5.5qt-everywhere-opensource-src-5.5.1Makefile [module-qtdeclarative-make_first] Error 2

    ——————————————– end console output ——————————————————–

    1. The output seems to have something to do with QML. Not sure about your case but I would suggest disabling QML if you don’t need it and try building again. If it finishes successfully then go back and this time build again using QML if you need it. Might be some dependency order in building. I haven’t tested this build with 64 bit yet but I’ll try it and let you know the results. Let me know what results you get with what I suggested.

      1. It seems I am not using QML as my QT program is based on a MainWindow and QDialog widgets and the logic is implemented in C++. So I should not need QML.

        Anyway, what is the procedure to disable QML when building the static QT ?

          1. I think I was able to make it work by skipping the qtDeclarative module.
            Also, I cloned the source code using Git to get the latest release version instead of one of their link on their download page.

            My configure command was:

            configure.bat -static -release -prefix “C:Qt5.5msvc2013_static” -platform win32-msvc2013 -skip qtdeclarative -no-openssl -opensource -confirm-license -make libs -nomake tools -nomake examples -nomake tests

            It seems that I am now able to generate standalone applications from QT.

            However, I was also trying a 64-bit version of static QT but I don’t see what command to change to select 64-bit instead of 32-bit. Is it even possible to generate a msvc 64-bit static version of QT?

          2. Glad to hear you successfully built it. Regarding what you asked, yes it is possible as long as you have:
            1. Correct “mkspecs” folder for 64 Bit MSVC 2013 under “qtbasemkspecs”
            2. A working compiler for 64 Bit MSVC 2013

            The parameter “-platform win32-msvc2013” in your command actually corresponds to a folder in “qtbasemkspecs” folder. So if there is a “win64-msvc2013” or something similar under that folder then you can build a 64 Bit version of Qt by supplying it to “-platform” parameter in configure. If there is no 64 Bit mkspecs folder there then you either have to create it yourself (please let me know of the results if you do) or you have to wait for Qt to create it for you in the next releases.

          3. Following-up on my previous comment, it seems that QT 5.6 does not support static build for 64-bit MSVC as there is no “win64-msvc2013” folder under the “qtbasemkspecs” (at least from their official Git release branch for 5.6)

            But I developed a stand-alone application using a 32-bit MSVC2013 static build of QT 5.6 and it works fine with 64-bit Windows OS.

          4. Yes, that is probably because it is still not an official release. (It is an Alpha release, or pre-release as they call it) I am confident there will be mkspecs for 64 bit of all recent MSVC compilers. Good luck!

  9. Hello sir …

    i followed ur tutorial and tried for 3-4 times and im getting errors after installing jom
    Nmake ::fatal erorr u1077 ‘cd’ return code 0x2 and so on…

    i hav Qt5.5 and visual studio express 2013

  10. one more thing sema, at which stage did you get this errors??? if you get them after running JOM, did you try running JOM INSTALL anyway? or did you just stop because of those errors? I suggest running JOM INSTALL anyway.

    1. after i finish configuration i just type : jom or jom.exe -j , the error appears about 9 minutes after starting building.

  11. Thanks for this nice tutorial , i have followed the steps closely but i still get from long time the same set of errors though and i wish to have some help
    the error log is :

    jom: C:Qt5.5qt-everywhere-opensource-src-5.5.0qtdeclarativesrcqmlMakefile.Debug [.generateddebugRegExpJitTables.h] Error 1

    jom: C:Qt5.5qt-everywhere-opensource-src-5.5.0qtdeclarativesrcqmlMakefile [debug-all] Error 2

    jom: C:Qt5.5qt-everywhere-opensource-src-5.5.0qtdeclarativesrcMakefile [sub-qml-make_first-ordered] Error 2

    jom: C:Qt5.5qt-everywhere-opensource-src-5.5.0qtdeclarativeMakefile [sub-src-make_first] Error 2

    jom: C:Qt5.5qt-everywhere-opensource-src-5.5.0Makefile [module-qtdeclarative-make_first] Error 2

    1. I would be glad to help but you need to provide some more info. Like your compiler version at least?! Did you use exactly the same configure command mentioned here? Are you sure that you have started cmd for the Visual Studio in Admin mode?

      1. i need to compile Qt 5.5 , i use MSVS 2013 , on win 7 and yes yes i did pretty similar to steps except the part of configure ,i changed these parts :

        “C:Qt5.5msvc2013_static” & win32-msvc2013

        Command line from VS 2013 with Run as Adminstrator

        I searched for how to add Environment variables , i did it like this
        Control panel -> Advanced system settings -> Advanced -> Environment Variables -> Variale -> Path

        and i added C:QtToolsQtCreatorbin , to what was there already

        I hope i have clarified it well.

        1. at this point I would recommend double checking all settings and commands because sometimes you really just miss a very small thing and it will end badly! Btw you can also use the contact me page to contact me directly. Maybe we can take a look at it in more detail.

    2. Same problem here. Seams to be a windows 10 problem:
      I solved it by skipping the module, but now i got the next error:
      Error: dependent ‘C:Qt5.5.1qt-everywhere-opensource-src-5.5.1qtdeclarativelibQt5Qmld.lib’ does not exist.
      jom: C:Qt5.5.1qt-everywhere-opensource-src-5.5.1qtwebchannelsrcwebchannelMakefile [debug-all] Error 2
      jom: C:Qt5.5.1qt-everywhere-opensource-src-5.5.1qtwebchannelsrcMakefile [sub-webchannel-make_first] Error 2
      jom: C:Qt5.5.1qt-everywhere-opensource-src-5.5.1qtwebchannelMakefile [sub-src-make_first] Error 2
      jom: C:Qt5.5.1qt-everywhere-opensource-src-5.5.1Makefile [module-qtwebchannel-make_first] Error 2

  12. hi What about shared libraries to build on any visual studio. is it compiling everything. means i need webkit as well. i am always seeing manytimes webkit is not builded

    1. To build shared libraries you need to remove STATIC option from CONFIGURE. To have Webkit you need to add WEBKIT option to CONFIGURE. Please note that Qt has some platform dependent stuff (I am not sure what are Webkit’s dependencies) and you need to know the OS compatibility and related info on the libraries you want to use.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.