Using UWP API with Qt

懵懂的女人 提交于 2021-02-08 10:27:22

问题


In Visual Studio I included: using namespace Windows::Devices::Enumeration; and it works. When adding/including namespaces in Qt I get errors. Any documentation how to use UWP API with Qt?

For example:

.h
#include <windows.devices.enumeration.h>

.cpp
DeviceAccessInformation deviceInfo;

I get error: C2065: 'DeviceAccessInformation': undeclared identifier

Update:

I have found some information related the issue. So I have added the Win SDK path (INCLUDEPATH += "C:/Program Files (x86)/Windows Kits/10/Include/10.0.16299.0") to the .pro file. Also added the #include "winrt/windows.devices.enumeration.h" to the header file but it still can't find the DeviceAccessInformation deviceInfo;, throws error: C2065: DeviceAccessInformation: undeclared identifier.

Also I have checked the samples, and add the namespace. using namespace winrt;

and it displays the error: C2871: 'winrt': a namespace with this name does not exist

Also I have noticed the warning: -1: warning: winrt_manifest_install.path is not defined: install target not created

I have included the WindowsApp library but the issue still exists.

contains(QMAKE_TARGET.arch, x86_64) {
    LIBS += -L"C:/Program Files (x86)/Windows Kits/10/Lib/10.0.16299.0/um/x64" -lWindowsApp
} else {
    LIBS += -L"C:/Program Files (x86)/Windows Kits/10/Lib/10.0.16299.0/um/x86" -lWindowsApp
}

I think the problem is with the wrong includes or I missing something.

Update 2:

Can anyone confirm that Qt 5.9.3 UWP x32/x64 kits work with UWP API? Thanks in advance.


回答1:


I have decided to develop native UWP app using Visual Studio even though I fixed the issue by installing Qt extension for VS and switching Win SDK kit to 16299.



来源:https://stackoverflow.com/questions/47995323/using-uwp-api-with-qt

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!