Results 1 to 4 of 4

Thread: Build static QT 5.1.0 on Windows x64 with Visual Studio 2012

  1. #1
    Join Date
    Aug 2013
    Posts
    7
    Thanks
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default Build static QT 5.1.0 on Windows x64 with Visual Studio 2012

    Hi

    I never programmed with QT so I do not know too much...
    I have:
    Windows 7 x64
    Visual studio 2012 (Ultimate)
    QT 5.1.0

    I want to build a static application (only one executable file, without any dll's, etc.) with QT and to be honest I do not know where to start
    I found this guide (link)
    And I did all steps.
    But I don't know what I need to do now..

    If the guide is true:
    Let's say I have a working static QT build under the “qtbase” directory
    How can I use it and compile a static application ?

    Else, if the guide is wrong:
    How can I build a static application with QT and VS2012 ?

    Thank you very much !

  2. #2
    Join Date
    Aug 2013
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Build static QT 5.1.0 on Windows x64 with Visual Studio 2012

    In short you'll need the visual studio plugin from here:

    http://download.qt-project.org/offic...opensource.exe

    Once installed load up visual studio and click the QT menu the QT options, here you need to add the path to the static build.
    You can then create a new QT project using the normal VS project wizard (there will be a new c++ QT section).

    Make sure to also set the project defaults under the QT menu once a new project is created.
    There's plenty of online tutorials for the rest as its not specific to static building.

  3. #3
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,713
    Thanks
    259
    Thanked 759 Times in 749 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: Build static QT 5.1.0 on Windows x64 with Visual Studio 2012

    But you will also have to make sure that you turn off all the compile and link flags that would otherwise tell VC++ that you are using a DLL build. Things like QT_DLL and the like. Otherwise, it will import Qt assuming DLL linkage, and you will get a completely different set of "mangled" names (and a zillion link errors for all those "undefined" symbols).

    The Visual Studio plugin is not required at all to do this, but it helps. You can build Qt apps in Visual Studio without it, so long as you specify the right compile options and libraries. The Qt plugin makes it easier, but only if you are following the standard method of making apps. Static builds are not standard.

    By the way, if you are using Qt open source in a commercial application, it is a violation of the LGPL license to link statically. You must buy a Qt Commercial license if you want to build a statically-linked commercial Qt app.
    Last edited by d_stranz; 17th August 2013 at 06:51.

  4. #4
    Join Date
    Aug 2013
    Posts
    7
    Thanks
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Build static QT 5.1.0 on Windows x64 with Visual Studio 2012

    Thank you very much !
    to both of you

Similar Threads

  1. Qt 5.1.1 not recognized by Visual Studio Add-in 2012
    By cdarwin in forum Qt Programming
    Replies: 0
    Last Post: 5th June 2013, 13:05
  2. Qt 5.0.1 + Visual Studio 2012 + OpenGL Error
    By Rayven in forum Qt Programming
    Replies: 2
    Last Post: 24th April 2013, 19:34
  3. Help regarding QT plugins for Visual studio 2012
    By shah_27 in forum Qt Programming
    Replies: 0
    Last Post: 9th January 2013, 10:42
  4. Build qt 5 with Visual Studio 2012
    By Edder in forum Installation and Deployment
    Replies: 4
    Last Post: 28th December 2012, 11:16
  5. [Solved] static build probs (Visual Studio.Net 2003)
    By darksaga in forum Installation and Deployment
    Replies: 2
    Last Post: 3rd September 2007, 18:46

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.