Sunday, 15 March 2015

c++ - Qt5.0.1 static linking in Visual Studio 2012 -



c++ - Qt5.0.1 static linking in Visual Studio 2012 -

i build qt next configuration:

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

and went fine. btw. changed in qmake.conf win32-msvc2012 mkspecs /md /mt static linking (according instructions). seek build simple application in visual studio 2012, using static linking. create simple project (this basic one, qt visual add-in) is:

#include "test.h" #include <qtwidgets/qapplication> int main(int argc, char *argv[]) { qapplication a(argc, argv); test w; w.show(); homecoming a.exec(); }

(test plain window) , set 2 things remember since doing on visual studio 2010: 1) project properties -> c/c++ -> code generation -> runtime library set mt 2) project properties -> general -> utilize of mfc set utilize mfc in static library

of cource in qt project settings have set static version of qt. in configuration i’m getting much errors – http://pastebin.com/6ve3pfuh [pastebin.com] libs (i think all) added qt add-in (qtmain.lib qt5core.lib qt5gui.lib qt5widgets.lib). if set utilize of mfc default value utilize standard windows libraries i’m getting this:

1> creating library d:\visual studio 11\projects\test\win32\release\test.lib , 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 thought going on. in visual studio 2010 , qt 4.8 works fine way. read more external dependencies should add together i’m not sure that. ohh , way – in qtcreator static linking works great, can’t see mysql plugin, mystery me , need original project.

i using visual studio 2013 noticed exact same missing link yesterday.

you need add together dependency ws2_32.lib.

if project compile crashes cryptic "windows platform plugin missing" message, need add together 1 cpp:

q_import_plugin(qwindowsintegrationplugin);

this add together new dependencies.

fyi dependencies utilize default qt project (some necessary angle):

winmm.lib ws2_32.lib dxguid.lib d3d9.lib imm32.lib qtmaind.lib qt5cored.lib qt5guid.lib qt5widgetsd.lib libegld.lib libgl esv2d.lib translator_commond.lib preprocessord.lib translator_hlsld.lib qwindowsd.lib qt5platformsupportd.lib %(additionaldependencies)

c++ qt visual-studio-2012 static-linking

No comments:

Post a Comment