简体   繁体   中英

Using UWP API with Qt

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.

我已经决定使用Visual Studio开发本机UWP应用,即使我通过安装VS Qt扩展并将Win SDK套件切换为16299来解决此问题。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM