Building QT from source code statically to be used with Visual Studio



  • Hello,
    I am developing a QT application using Visual Studio. Since I want to create a standalone application that can be used without having to install DLL files, I have selected "Multi-threaded" instead of "Multi-threaded DLL" in the runtime library option in Visual Studio. However, this requires that I build all associated 3rd party libraries statically. I did some research and found helpful instructions here.
    http://amin-ahmadi.com/2016/09/22/how-to-build-qt-5-7-statically-using-msvc14-microsoft-visual-studio-2015/
    I followed all the instructions, but in the end I got the error "module machine type 'X86' conflicts with target machine type 'x64' ". I searched for the cause of this error and apparently the QT source code was built for an x86 platform. I found this by using the command

    ./dumpbin.exe "C:\Qt\Static\5.7.0\lib\Qt5Chartsd.lib" -he
    aders | findstr machine
    

    I am using Visual Studio 2015 Community on a 64-bit Windows 10 system. What do I need to do to build QT statically from the source code, so that it can be seamlessly used with Visual Studio on a 64 bit system.
    Thanks in advance.


  • Lifetime Qt Champion

    Hi,

    Use the amd64 command prompt when building Qt.



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