Issue when building UWP app with Qt UWP x32/x64 Kits - c++

I have downloaded from GitHub directory cppwinrt it contains the header files to use UWP API with Qt. The Qt version is 5.9.3.
I have included it in .pro file:
INCLUDEPATH += "C:/Users/cobra/Downloads/Downloads Data/cppwinrt/10.0.16299.0"
.h file:
#include <winrt/windows.devices.enumeration.h>
#pragma comment(lib, "windowsapp")
using namespace winrt;
using namespace winrt::Windows::Devices::Enumeration;
.cpp file:
init_apartment(); //this initializes com
DeviceInformationCollection infos = DeviceInformation::FindAllAsync().get();
for (const auto &info : infos) {
qDebug() << QString::fromWCharArray(info.Name().c_str());
}
I want to get some device information. The problem is, it compiles only for ARMV7 kit. On x32/x64 kits it displays a lot of errors:
I have checked it and all errors are from cppwinrt directory where the header files located. How to fix it to build for x32/x64 kits?
Update:
Without UWP API includes, the application compiles and runs.
Thanks in advance.

I have fixed the issue by installing Qt extension to Visual Studioand selecting Win SDK to 10.0.16299.0, now it compiles for all architectures.

Related

cannot open include file 'Graphics.hpp' no such file or directory ,additional include for visual studio not working

i m trying to use sfml in my project using visual studio 2019. Following sfml documentation to perform setup for visual studio i have performed all the action required
i have included include folder in c/c++/additional include directory and also provided path for lib folder in linker setting and also provided additional dependencies in linker/input
but
#include <iostream>
#include <SFML/Graphics.hpp>
int main()
{
std::cout << "i cant tolerate" << std::endl;
return 0;
}
this code shows above mentioned error ,
cannot open include file 'Graphics.hpp' no such file or directory
it seems like include path is not working
how can i solve this issue
i tried many times but got same result
if anyone facing the same problem please check the platform in the project/properties win32 worked for my particular problem

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.
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.

Can't compile dll from C++ project - Visual Studio

I'm trying to play a RTSP stream in Unity 5.
For that I found a RTSP-plugin for Unity on Github that I want to try, but unfortunatelly it comes with no Readme or installation guide whatsoever.
So far I found out that I'm dealing with a C++ Visual Studio project that needs to be compiled into a DLL in order to add it to Unity. But when I try to build the project I get the following Error for the header file "ffmpegenv.h":
Error C1083 Cannot open include file: 'libavutil\opt.h': No such file or directory - (Screenshot)
Here's the code from the header file
#pragma once
//=============================
// Includes
//-----------------------------
// FFMPEG is writen in C so we need to use extern "C"
//-----------------------------
extern "C" {
//#define INT64_C(x) (x ## LL)
//#define UINT64_C(x) (x ## ULL)
#include <libavutil\opt.h>
#include <libavutil/mathematics.h>
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>
#include <libswresample/swresample.h>
#include <libavutil/imgutils.h>
#include <libavcodec/avcodec.h>
}
I'm aware that the header includes source code from the FFmpeg libraries which doesn't come with the plugin I'm trying to compile. So I downloaded the FFmpeg source code from their GitHub page and copied all the code files (with its original folder structure) inside the plugin's project folder.
However when I then try to compile the plugin, it still doesn't find the #includes an shows the same error as mentioned above.
How I can I get the plugin to compile? What am I missing?
Thanks in advance
P.S.: I'm using Visual Studio Community 2017 with C++ support and Win 10 SDK as well as Win 8.1 SDK.

Linking native WebRTC application with Visual Studio

So my goal is to build a native WebRTC application using the WebRTC C++ api.
I compiled webrtc for use with Visual Studio (2015) using the following guide:
https://github.com/ipop-project/ipop-project.github.io/wiki/Building-the-WebRTC-lib-for-Windows
After the build completed I tried creating a new Visual Studio console project and added the following code:
#include <iostream>
#define WEBRTC_WIN
#include <webrtc/api/peerconnection.h>
#include <webrtc/api/peerconnectionfactory.h>
#include <webrtc/api/peerconnectioninterface.h>
int main()
{
auto pcf = webrtc::CreatePeerConnectionFactory();
std::cout << "Hallo!" << std::endl;
}
Adding the build directory to the include search path works fine, however I'm unable to link the application, searching the build directories for lib-files and adding them to the linker only adds more link error as there is a whole bunch and I suspect some of them should not be linked to my application.
What is the correct way to link the application, and how do I know what .lib-files the functionality I use resides in?
I solved it!
After digging around in the build files for the examples in WebRTC I found that the following libraries should be linked:
obj\webrtc\api\libjingle_peerconnection.lib
obj\webrtc\system_wrappers\field_trial_default.lib
obj\webrtc\system_wrappers\metrics_default.lib
obj\third_party\jsoncpp\jsoncpp.lib
obj\webrtc\media\rtc_media.lib
obj\webrtc\base\rtc_base_approved.lib
obj\webrtc\webrtc_common.lib
obj\webrtc\webrtc.lib
obj\webrtc\system_wrappers\system_wrappers.lib
obj\webrtc\voice_engine\voice_engine.lib
obj\webrtc\common_audio\common_audio.lib
obj\third_party\openmax_dl\dl\openmax_dl.lib
obj\webrtc\common_audio\common_audio_sse2.lib
obj\webrtc\modules\audio_coding_module.lib
obj\webrtc\modules\cng.lib
obj\webrtc\modules\audio_encoder_interface.lib
obj\webrtc\modules\g711.lib
obj\webrtc\modules\pcm16b.lib
obj\webrtc\modules\ilbc.lib
obj\webrtc\modules\webrtc_opus.lib
obj\third_party\opus\opus.lib
obj\webrtc\modules\g722.lib
obj\webrtc\modules\isac.lib
obj\webrtc\modules\audio_decoder_interface.lib
obj\webrtc\modules\isac_common.lib
obj\webrtc\modules\red.lib
obj\webrtc\rtc_event_log.lib
obj\webrtc\rtc_event_log_proto.lib
protobuf_lite.dll.lib
obj\webrtc\modules\neteq.lib
obj\webrtc\modules\builtin_audio_decoder_factory.lib
obj\webrtc\modules\audio_decoder_factory_interface.lib
obj\webrtc\modules\rent_a_codec.lib
obj\webrtc\modules\audio_conference_mixer.lib
obj\webrtc\modules\audio_processing.lib
obj\webrtc\modules\audioproc_debug_proto.lib
obj\webrtc\modules\audio_processing_sse2.lib
obj\webrtc\modules\webrtc_utility.lib
obj\webrtc\modules\media_file.lib
obj\webrtc\base\rtc_task_queue.lib
obj\webrtc\modules\audio_device.lib
obj\webrtc\modules\bitrate_controller.lib
obj\webrtc\modules\paced_sender.lib
obj\webrtc\modules\rtp_rtcp.lib
obj\webrtc\common_video\common_video.lib
libyuv.lib
obj\third_party\libjpeg_turbo\libjpeg.lib
obj\webrtc\modules\remote_bitrate_estimator.lib
obj\webrtc\voice_engine\level_indicator.lib
obj\webrtc\modules\congestion_controller.lib
obj\webrtc\modules\video_capture_module.lib
obj\webrtc\modules\video_processing.lib
obj\webrtc\modules\video_processing_sse2.lib
obj\webrtc\modules\webrtc_video_coding.lib
obj\webrtc\modules\webrtc_h264.lib
obj\webrtc\modules\webrtc_i420.lib
obj\webrtc\modules\video_coding\utility\video_coding_utility.lib
obj\webrtc\modules\video_coding\codecs\vp8\webrtc_vp8.lib
obj\third_party\libvpx\libvpx.lib
obj\third_party\libvpx\libvpx_intrinsics_mmx.lib
obj\third_party\libvpx\libvpx_intrinsics_sse2.lib
obj\third_party\libvpx\libvpx_intrinsics_ssse3.lib
obj\third_party\libvpx\libvpx_intrinsics_sse4_1.lib
obj\third_party\libvpx\libvpx_intrinsics_avx.lib
obj\third_party\libvpx\libvpx_intrinsics_avx2.lib
obj\webrtc\modules\video_coding\codecs\vp9\webrtc_vp9.lib
obj\webrtc\p2p\rtc_p2p.lib
obj\webrtc\base\rtc_base.lib
boringssl.dll.lib
obj\third_party\usrsctp\usrsctplib.lib
obj\webrtc\modules\video_capture_module_internal_impl.lib
obj\third_party\winsdk_samples\directshow_baseclasses.lib
obj\webrtc\pc\rtc_pc.lib
obj\third_party\libsrtp\libsrtp.lib
winmm.lib
dmoguids.lib
wmcodecdspuuid.lib
amstrmid.lib
msdmo.lib
crypt32.lib
iphlpapi.lib
secur32.lib
Strmiids.lib
The document you linked to, says you need the following libraries:
boringssl.dll.lib
boringssl_asm.lib
field_trial_default.lib
jsoncpp.lib
rtc_base.lib
rtc_base_approved.lib
rtc_p2p.lib
rtc_xmllite.lib
rtc_xmpp.lib
I would link against all of them. It's unlikely to hurt.
There is a precompiled (binary) package available for Windows: here.
It contains a single lib to link, libwebrtc_full.lib

Using gdcm libs in UE4

For my UE4 project I want to use the GDCM libraries for C++ to load CT Scans. So I really tried a lot the last few days but I'm still not able to use GDCM... But where is the error? Can someone help me?
I created the dll and lib files with CMake (VS 2013 Win64) successfully.
I put all the libs in ...Unreal Projects\VolumeImport\ThirdParty\Includes\GDCM\Libraries
I added each of the 16 libs in the VolumeImport.Build.cs with
PublicAdditionalLibraries.Add(Path.Combine(LibrariesPath, "gdcmMSFF.lib"));
PublicAdditionalLibraries.Add(Path.Combine(LibrariesPath, "gdcmCommon.lib")); ...
I put all the header files in Unreal Projects\VolumeImport\ThirdParty\Includes\GDCM\Includes
I set the Includepath to this location in the project properties.
I put all the dlls in C:\Windows\System32
Then I used the headers:
#include "VolumeImport.h"
#include <gdcmVersion.h>
#include <gdcmReader.h>
#include <gdcmPixmapReader.h>
#include <gdcmImageReader.h>
#include <gdcmAttributes.h>
bool CTFileLoader::Convert_DICOM()
{
/** ... other well working code ... */
gdcm::Trace::SetDebug(false); gdcm::Trace::SetError(true);
gdcm::ImageReader reader;
reader.SetFilename(files_to_process[i].c_str());
if(!reader.Read()) { }
}
And I get an error in the gdcmMediaStorage.h: "error C4515: 'gdcm': Namespace uses itself."
I tried using different includes but this causes diffrent errors in diffrent headers... Is there something wrong with the libraries? But I'm sure they were added, because using only the gdcmTrace.h and the gdcm::Trace::functions works fine.
Now I got the solution:
In my VolumeImport.Build.cs I additionally added the DLLs:
PublicDelayLoadDLLs.Add(Path.Combine(LibrariesPath, "gdcmMSFF.dll")); ...
I changed the gdcmMediaStorage.h file: Comment out the "using namespace gdcm;"
Furthermore I had dynamic_cast problems with this big library and it needs to enable RTTI