Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Can a Qt 5.6 Desktop app (msvc 2015) use WinRT libraries (C++/CX)?
Forum Update on Monday, May 27th 2025

Can a Qt 5.6 Desktop app (msvc 2015) use WinRT libraries (C++/CX)?

Scheduled Pinned Locked Moved Unsolved General and Desktop
desktopvisual studiowinrtwindows 10c++cx
2 Posts 2 Posters 2.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Simurr
    wrote on 2 May 2016, 19:49 last edited by
    #1

    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 [60]' 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?

    M 1 Reply Last reply 19 May 2016, 13:11
    0
    • S Simurr
      2 May 2016, 19:49

      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 [60]' 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?

      M Offline
      M Offline
      mkalinow
      wrote on 19 May 2016, 13:11 last edited by
      #2

      @Simurr
      Hi,

      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.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved