Qt5.0.1 static linking in MSVC 2012



  • I build Qt with a following configuration:

    @-platform win32-msvc2012 -no-icu -no-angle -opengl desktop -static -qt-sql-mysql -qt-plugins-mysql -nomake demos -nomake examples@

    and everything went fine. Btw. i also changed in qmake.conf for win32-msvc2012 mkspecs /MD to /MT for static linking (according to some instructions). Now i try to build the most simple application in Visual Studio 2012, using static linking. So i create simple project (this basic one, from Qt Visual Add-in) which is:

    @#include "test.h"
    #include <QtWidgets/QApplication>

    int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);
    test w;
    w.show();
    return a.exec();
    }@

    (test is just a plain window) and set two things which i remember since i was doing it on Visual Studio 2010:

    1) Project properties -> C/C++ -> Code generation -> Runtime library i set to MT
    2) Project properties -> General -> Use of MFC i set to Use MFC in a static library

    Of cource in Qt project settings i have set my static version of Qt. In this configuration i'm getting so much errors - "http://pastebin.com/6ve3pFUh":http://pastebin.com/6ve3pFUh All libs (i think that all) were added by Qt Add-in (qtmain.lib
    Qt5Core.lib Qt5Gui.lib Qt5Widgets.lib). If i set Use of MFC to default value which is Use standard Windows libraries then i'm getting this:

    @1> Creating library D:\Visual Studio 11\Projects\test\Win32\Release\test.lib and object D:\Visual Studio 11\Projects\test\Win32\Release\test.exp
    1>Qt5Core.lib(qeventdispatcher_win.obj) : error LNK2019: unresolved external symbol _WSAAsyncSelect@16 referenced in function "private: void __thiscall QEventDispatcherWin32::createInternalHwnd(void)" (?createInternalHwnd@QEventDispatcherWin32@@AAEXXZ)
    1>D:\Visual Studio 11\Projects\test\Win32\Release\test.exe : fatal error LNK1120: 1 unresolved externals@

    I totally have no idea what is going on. In Visual Studio 2010 and Qt 4.8 everything works perfectly fine this way. I read something about more external dependencies which i should add but i'm not sure about that. Ohh and by the way - in QtCreator this static linking works great, but it can't see MySQL plugin, which also is a mystery for me and i need it to my original project.


Log in to reply
 

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