VS2010/VS2012RC dynamic linkage of Qt libraries



  • My goal is to setup a VS2012RC project (or, if necessary, a VS2010Express project) that uses Qt libraries dynamically. However, I can not seem to find any clear guide or instructions on how to do this.

    My question to you: do you know a guide or can you instruct me how to setup Visual Studio for dynamic linkage with Qt libraries?

    Some clarification:
    As far as I've read, dynamic linkage is required by the LGPL license. Therefore I would like to have the libraries linked dynamically.
    I have built the libraries according to "this guide":http://stackoverflow.com/questions/5601950/how-to-build-qt-for-visual-studio-2010. This guide is aimed at VS2010, so I'm wondering if this will work with VS2012RC.
    My goal is to create an OpenGL application that uses Qt to setup a single window to render to. I will keep the Qt usage to a minimum. All rendering code past the window/context setup will not make direct use of Qt.


  • Moderators

    welcome to devnet

    The easiest is probably to "download the binaries":http://releases.qt-project.org/qt4/source/qt-win-opensource-4.8.2-vs2010.exe for msvc 2010. They are already compiled and ready to use with your msvc 2010 express.

    If you really like to use msvc 2012 RC you may start by using the compile options as supplied for msvc 2010. Also the guide is probably the only thing available at this time. My assumption is that it could run through without any problems. However, also the complete opposite is possible and you are opening a can of worms.



  • I managed to create a working helloworld project for Visual Studio 2010. However, upon building the project in VS2012RC I get a _MSC_VER mismatch when it's linking the libraries.

    Does this mean the libraries have to be rebuilt to be used with VS2012RC? And is this possible?


  • Moderators

    Libraries from different MS VC versions have been incompatible in the past. That is probably the reason why you are seeing the version mismatch version. It is probably saver to assume that this has been continued for MS VC 2012. So, you would need to compile for msvc2012.



  • I managed to compile the helloworld example on VS2012RC.

    Following "the guide":http://stackoverflow.com/questions/5601950/how-to-build-qt-for-visual-studio-2010 I linked in my opening post, there is one step that needs to be done before running nmake. This is described in "this workaround":http://qt-project.org/forums/viewthread/14531.

    The relevant part for my problem was:

    bq. As there isn’t yet a VS2011 mkspec, you should build with the VS2010 mkspec.
    Just modify this line in QTDIR\mkspecs\win32-msvc2010\qmake.conf to read:
    QMAKE_COMPILER_DEFINES += _MSC_VER=1700 WIN32
    This will tell the compiler which symbol prefix (used to identify the compiler) to put in the libs.

    Just this suffices to make (supposedly) most of the libraries compatible with VC2012RC. Some libraries might not compile with just this solution, as described in the workaround.


Log in to reply
 

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