Can a Qt 5.6 Desktop app (msvc 2015) use WinRT libraries (C++/CX)?
I've tried this in QtCreator and Visual Studio 2015. I've played with different configurations and as far as I can tell I've got the environment setup correctly.
However, whenever I make an API call (so far I've only been trying WiFi Direct calls) and build in Release mode I get this error.
C2664 'long __winRT::__getActivationFactoryByPCWSTR(void *,Platform::Guid &,void **)': cannot convert argument 1 from 'const wchar_t ' to 'void *'
In Debug I get these errors in Visual Studio 2015.
Error LNK2038 mismatch detected for '_MSC_VER': value '1800' doesn't match value '1900' in main.obj qtmaind.lib(qtmain_win.obj)
Error LNK2001 unresolved external symbol "public: virtual struct QMetaObject const * __thiscall MainWindow::metaObject(void)const " (?metaObject@MainWindow@@UBEPBUQMetaObject@@XZ) PROJECT mainwindow.obj
Error LNK2001 unresolved external symbol "public: virtual void * __thiscall MainWindow::qt_metacast(char const *)" (?qt_metacast@MainWindow@@UAEPAXPBD@Z) SSLocalServer mainwindow.obj
Error LNK2001 unresolved external symbol "public: virtual int __thiscall MainWindow::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@MainWindow@@UAEHW4Call@QMetaObject@@HPAPAX@Z) mainwindow.obj
Error LNK2019 unresolved external symbol "__declspec(dllimport) char const * __cdecl std::_Winerror_map(int)" (__imp_?_Winerror_map@std@@YAPBDH@Z) referenced in function "public: virtual class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall std::_System_error_category::message(int)const " (?message@_System_error_category@std@@UBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@H@Z) qtmaind.lib(qtmain_win.obj)
Simple question first. Is it even possible with the current version of Qt 5.6 to use the WinRT API (Specifically WiFi Direct) in a Desktop application?
If it is, what am I missing?
I am not sure whether WiFi Direct is among the supported APIs which can be co-used for classic apps. But usually you need to take care of a couple of things.
Most promintently you will need to link against runtimeobject.lib to find Activation symbols.
I just pushed a change for positioning to showcase, how a "generic" porting from WinRT to classic apps can work. See https://codereview.qt-project.org/#/c/159330/ for some details.