PDA

View Full Version : Qt5 and MSVC2012 - unresolved external error



Blood9999
13th February 2013, 16:40
I'm trying to compile the most basic Qt program with static linking, using Visual Studio 2012 with installed add-in to Qt. I have build Qt with:

configure -platform win32-msvc2012 -no-angle -opengl desktop -no-icu -static -nomake demos -nomake examples

Everything went perfect. I have created project Qt5:


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

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

(test w is just a window) and tried to compile it but i'm getting error:

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

All libs are included (this is done by add-in) and in project settings -> C/C++ -> Code generation i set Runtime library to MT (static linking). Any ideas?

EDIT

Btw. in Qt Creator everything works fine.

Salads
13th February 2013, 23:46
Have you tried adding


CONFIG += static
to your .pro file?

amleto
16th February 2013, 20:26
have you linked with WS2_32.DLL/lib ?