PDA

View Full Version : MSVC 2010 with wizard plugin: Project fails to link with wizard generated code



Meek the Geek
29th September 2011, 07:53
Hi, I have Visual studio 2010, and I have compiled the QT 4.7.1 library and I have installed the Nokia QT plugin for MSVC

I can now use the wizard to generate a project, ex: QT Console application with QTCore, and QTGUI

The default project looks like this, and it compiles and runs even if it fails to be useful


#include "qapplication.h"

int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);

QString appName("Colton Configurator V1.0");
a.setApplicationName(appName);

return a.exec();
}

Now, all I do is add the following lines


#include "qapplication.h"
#include "qwidget.h"

int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);

QString appName("Colton Configurator V1.0");
a.setApplicationName(appName);


QWidget widget;
//widget.show();


return a.exec();
}

and then I get the linker insanity shown below. I think this is a problem with the plugin not calling QMake to update stuff once compiled, but how do you get around this problem? I get a similar problem if I use the command "Clean All" prior to rebuilding.

Any help is appreciated, thanks.

meek




1> All outputs are up-to-date.
1>QtGuid.lib(qaccessible_win.obj) : error LNK2019: unresolved external symbol __imp__PlaySoundW@12 referenced in function "public: static void __cdecl QAccessible::updateAccessibility(class QObject *,int,enum QAccessible::Event)" (?updateAccessibility@QAccessible@@SAXPAVQObject@@ HW4Event@1@@Z)
1>QtGuid.lib(qwininputcontext_win.obj) : error LNK2019: unresolved external symbol _ImmSetCandidateWindow@8 referenced in function "public: virtual void __thiscall QWinInputContext::update(void)" (?update@QWinInputContext@@UAEXXZ)
1>QtGuid.lib(qwininputcontext_win.obj) : error LNK2019: unresolved external symbol _ImmSetCompositionWindow@8 referenced in function "public: virtual void __thiscall QWinInputContext::update(void)" (?update@QWinInputContext@@UAEXXZ)
1>QtGuid.lib(qwininputcontext_win.obj) : error LNK2019: unresolved external symbol _ImmSetCompositionFontW@8 referenced in function "public: virtual void __thiscall QWinInputContext::update(void)" (?update@QWinInputContext@@UAEXXZ)
1>QtGuid.lib(qwininputcontext_win.obj) : error LNK2019: unresolved external symbol _ImmGetContext@4 referenced in function "struct HIMC__ * __cdecl getContext(struct HWND__ *)" (?getContext@@YAPAUHIMC__@@PAUHWND__@@@Z)
1>QtGuid.lib(qwininputcontext_win.obj) : error LNK2019: unresolved external symbol _ImmReleaseContext@8 referenced in function "void __cdecl releaseContext(struct HWND__ *,struct HIMC__ *)" (?releaseContext@@YAXPAUHWND__@@PAUHIMC__@@@Z)
1>QtGuid.lib(qwininputcontext_win.obj) : error LNK2019: unresolved external symbol _ImmNotifyIME@16 referenced in function "void __cdecl notifyIME(struct HIMC__ *,unsigned long,unsigned long,unsigned long)" (?notifyIME@@YAXPAUHIMC__@@KKK@Z)
1>QtGuid.lib(qwininputcontext_win.obj) : error LNK2019: unresolved external symbol _ImmGetCompositionStringW@16 referenced in function "long __cdecl getCompositionString(struct HIMC__ *,unsigned long,void *,unsigned long)" (?getCompositionString@@YAJPAUHIMC__@@KPAXK@Z)
1>QtGuid.lib(qwininputcontext_win.obj) : error LNK2019: unresolved external symbol _ImmAssociateContext@8 referenced in function "void __cdecl enableIme(class QWidget *,bool)" (?enableIme@@YAXPAVQWidget@@_N@Z)
1>QtGuid.lib(qwininputcontext_win.obj) : error LNK2019: unresolved external symbol _ImmGetDefaultIMEWnd@4 referenced in function "struct HWND__ * __cdecl getDefaultIMEWnd(struct HWND__ *)" (?getDefaultIMEWnd@@YAPAUHWND__@@PAU1@@Z)
1>C:\Users\Admin\Documents\Visual Studio 2010\Projects\Mike_qt_config\\Mike_qt_config.exe : fatal error LNK1120: 10 unresolved externals
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:01.10

Zlatomir
29th September 2011, 11:14
Try it with QApplication (http://doc.qt.nokia.com/latest/qapplication.html) instead of QCoreApplication (http://doc.qt.nokia.com/latest/qcoreapplication.html)

//and also the includes should be between <> and without .h
Hello world:


#include <QApplication>
#include <QWidget>

int main(int argc, char *argv[])
{
QApplication a(argc, argv);

QString appName("Colton Configurator V1.0");
a.setApplicationName(appName);


QWidget widget;
widget.show();
return a.exec();
}