Intel Galileo and C++ REST SDK - c++

I've successfully setup my Intel Galileo board (Gen 2) with the latest Windows IoT image (2/12/2014). I can boot the image without any issues, telnet into it and run a 'blink' application fine.
I've tried to run the 'Casablanca' sample and followed the instructions from http://ms-iot.github.io/content/Casablanca.htm. When I telnet into the Galileo board and try to run the console application I'm getting no output at all. When trying to debug from Visual Studio I can see the following output:
First-chance exception at 0x77CC342A (ntdll.dll) in WindowsIoTDemo.exe: 0xC0000139: Entry Point Not Found.
The program '[2016] WindowsIoTDemo.exe' has exited with code -1073741511 (0xc0000139) 'Entry Point Not Found'.
Has anyone been able to run the Casablanca sample application, or use the C++ REST SDK in a 'Windows for IoT' project at all?

I had the same problem when using the latest release of Casablanca, 2.3. In order to run the sample, I used Casablanca 2.2:
Since there doesn't appear to be a way to download the 2.3 source code from Codeplex, the only way I could see was to use Git:
git clone https://git01.codeplex.com/casablanca
git checkout 9cc7758d714b
At this point, you can follow the instructions in the Galileo sample to build cpprest120d_2_2.dll and copy it to the Galileo. Be sure to set the "No Enhanced Instructions" option.
Create a new project for the sample as directed, but don't use NuGet to install cpprestsdk. This will install the 2.3 version. Instead, you want to include the 2.2 version you built earlier...
Add the casablanca120.vcxproj project from your Git folder to your solution
In your sample project, add a Reference to the Casablanca DLL project: Project properties -> Common Properties -> References
Add the Casablanca 2.2 header folder to your sample project: Project properties -> Configuration Properties -> C/C++ -> General. Set the "Additional Include Directories" field to your-casablanca-folder\Release\include.
That's it - build and run.

Entry point not found error means there is a depending dll, in which some method is missing. To enable more diagnostic output, you can change registry key GlobalFlag=2 under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager. In my case the following methods is missing UnregisterClassW. This method is defined in User32.dll and if you compare User32.dll in you workstation Windows with the one in Galileo, you’ll see that these files are pretty much different.
You can find out on my blog how I fixed/workarounded the problem http://kardum.net/iot/intel-galileo-windows-application-azure-storage/

Related

How to build&run Unreal C++ project on Linux?

I'm trying to build my first Unreal C++ project on Linux.
I built the engine from source in accordance with "Linux Quick Start" guide. Then I installed Qt Creator and followed the "How to Set up Qt Creator for UE4" guide.
I successfully set up and ran UE4Editor, and created a new C++ project. Unfortunately when I try running the project it complains:
And when I press "yes" this error message is shown:
Here's the error message from the logs:
ERROR: Building would modify the following engine files:
/media/redacted-disk/UnrealEngine/Engine/Binaries/Linux/Android/UE4Editor.modules
/media/redacted-disk/UnrealEngine/Engine/Binaries/Linux/Linux/UE4Editor.modules
/media/redacted-disk/UnrealEngine/Engine/Binaries/Linux/UE4Editor.modules
/media/redacted-disk/UnrealEngine/Engine/Plugins/2D/Paper2D/Binaries/Linux/UE4Editor.modules
/media/redacted-disk/UnrealEngine/Engine/Plugins/AI/AISupport/Binaries/Linux/UE4Editor.modules
... many more
I tried rebuilding UE4 from IDE, then building again - but the error still persists. Same thing happens if I try starting UE4Editor from the engine files and opening the project from there.
What could cause this error? Why does it even try to rebuild the engine when I'm tring run a project?
I have the following script to add the paths to the engine scripts and binaries to my PATH:
UNREAL_HOME="/path/to/source/of/UnrealEngine"
UNREAL_SCRIPTS="${UNREAL_HOME}/Engine/Build/BatchFiles"
UNREAL_SCRIPTS_LINUX="${UNREAL_HOME}/Engine/Build/BatchFiles/Linux"
UNREAL_BINS="${UNREAL_HOME}/Engine/Binaries/Linux"
PATH="${PATH}:${UNREAL_BINS}:${UNREAL_SCRIPTS}:${UNREAL_SCRIPTS_LINUX}"
export PATH
Then I run UE4Editor '/absolute/path/to/project.uproject' from within the directory of my project.
I never create a project inside the source tree of the engine. Paths should absolutely be different.
I use VS-Code as the IDE. This is what works best from my experience. QT-Creator will work only if you create an include files with lots of #define that are missing from the .pro files created by unreal.
You can configure VS-Code to have an intelli-sense like completion by installing the C# and C/C++ extensions. I had to install mono in order to get OmniSharp working (this is the server than handles the autocompletion for VS-Code). Here is an extract of my VS-Code settings.json file:
"omnisharp.path": "/home/myuser/.vscode/extensions/ms-dotnettools.csharp-1.23.9/.omnisharp/1.37.6/omnisharp/OmniSharp.exe",
"omnisharp.monoPath": "/usr/bin/mono",
You can also install the C++ Helper extensions which is usefull for creating methods, classes, and so on.
In the directory of your project run 'make YOURPROJECTNAMEEditor', then you can run 'open YOURPROJECTNAME.uproject' and it should open.

Cannot access filesystem in CMake UPW Project

I built an application that uses OpenXR with DirectX to display a simple scene in VR. As I'm tasked with implementing this in an already existing project, it's built using CMake, which works perfectly fine with Visual Studio 2019.
The application can run without any issues on the Windows MR Portal, as well as on the Oculus Rift S with the Oculus OpenXR runtime.
Now the next step is to get it running on the hololens. As I need an UWP project to do this, I created a .sln for the application I want to run on the hololens with CMake as follows:
cmake -G "Visual Studio 16 2019" -A x64 ..\.. -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0
With this, I can open the project and compile it as UWP, works without any issues. Now, when I want to run the application to debug it, I get the following error:
Exception thrown at 0x00007FFD3CC83E49 in openxr_test_app.exe: Microsoft C++ exception: std::filesystem::filesystem_error at memory location 0x00000046791CCF50.
Error [GENERAL | | OpenXR-Loader] : Unknown failure: canonical: Access denied: "C:\WINDOWS\system32\MixedRealityRuntime.json"
After some googling, I found out that I might need to add the relevant capability to the Package.appxmanifest, so I added
<rescap:Capability Name="broadFileSystemAccess"/>
as well as
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
and
IgnorableNamespaces="uap mp rescap"
to my Package.appxmanifest and enabled filesystem access for my application in the windows settings panel.
However, I still get the error above, I also tried to access other files on my PC (as I thought maybe system32 is a bit more restricted), but with no success.
I'm especially confused, because the OpenXR sample app from Microsoft works without any issues, and they did not declare the broadFileSystemAccess capability.
Are there any other ways to allow file access, or am I just missing something that I need to enable?
So as a quick follow-up, if anyone runs into the same issue: The problem here was a bug in the OpenXR loader that was introduced in version 1.0.10 of OpenXR.
Updating to OpenXR 1.0.11 solved the issue of the loader not being able to access the MixedRealityRuntime.json file.

Building UWP app from command line

I need to create kind of builder for my Universal Windows App (UWP) application, that would load some configuration into it, build it and create app store package. Is there any way to build UWP app from command line, without associating it with the store and using Visual Studio at all?
There is WinAppDeployCmd, but it can be used to install builded appx package on device and I need tool like that to generate that package.
UPDATE
I've managed to build it and create app packages with command line, here is command I used:
msbuild "path to .csproj file" /p:OutDir=output_dir /p:AppxBundle=Always;AppxBundlePlatforms="x86|x64|ARM" /p:BuildAppxUploadPackageForUap=true
It's working but not as it should apparently. I can not install generated appx package on my phone (and emulator). I just get error
Failure reason: Failed to start deployment. Failure text: Install failed. Please contact your software vendor. (0x80073cf9)
I found many solutions for Windows 10 PC version, but there is only one solution I found for Windows 10 Mobile and this "solution" is to hard reset the phone, but I do not want to do that. Is there any other way?
And there is one more problem. This command doesn't work with parameter /p:Configuration=Release; and it only builds with Debug configuration, but I believe this is not related to previous error, because it doesn't work with Visual Studio either.
UPDATE
I could not find another solution, so I did the 'hard reset' of my phone and now it is working. It's sad, but I hope the reason is the Windows 10 Mobile OS is still in beta version.
Step 1 : See, you need to install .NET Framework installer from the below link. https://www.microsoft.com/en-us/download/details.aspx?id=30653
Step 2 : Go to C: drive and find where msbuild.exe is. You will find more msbuild. But mostly it will be in the location like C:\Windows\Microsoft.NET\Framework\v4.0.30319.
Step 3: Open the CMD in administrator and point to the location which is mentioned in Step 2.
Step 4 : Paste this. msbuild.exe "YourCompleteProjectPath.sln" /t:rebuild
See this for reference : https://msdn.microsoft.com/en-us/library/ms164311%28v=vs.85%29.aspx

How to build a VS2010 C++ Project on a BuildServer

I've a .NET Solution with a managed C++ assemlby Targeting .NET 3.5 created with VS2010. The command:
%windir%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe MyProject.sln
compiles the solution on my dev machine.
On my BuildServer I get this error:
Build FAILED.
"F:\CruiseControl.NET\Projects\MyProject\MyProject.sln"
(default target) (1) ->
"F:\CruiseControl.NET\Projects\MyProject\MyProject\MyProject.csproj"
(default target) (2) ->
"F:\CruiseControl.NET\Projects\MyProject\MyProjectMAPIHelper\MyProjectMAPIHelper.vcxproj"
(default target) (3) ->
F:\CruiseControl.NET\Projects\MyProject\MyProjectMAPIHelper\MyProjectMAPIHelper.vcxproj(23,3):
error MSB4019: The imported project
"C:\Program
Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.Cpp.Default.props"
was not found. Confirm that the path
in the <Import> declaration is
correct, and that the file exists on
disk.
0 Warning(s)
1 Error(s)
On my dev machine the claimed file
"C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.Cpp.Default.props"
exists. On my build server not.
When I try to copy this files (and all others in the same directory) other errors occurred. So this is the wrong way.
EDIT: other errors means: When I copy the file "Microsoft.Cpp.Default.props" on the build server, MSBuild is claiming other files. That shows me, that just doing a copy of missing files is not what the build environment is expecting. I am looking for an MSI/whatever package that I could install on my build server and any C++ Project will build. Installing the SDK did not the trick. Or I did something wrong during SDK installation. Or it is not possible to compile Managed C++ VS2010 Solutions just with the SDK.
I believe that "other errors" has nothing to do with my problem. My Problem is: "How do I setup my build environment correctly". /EDIT
What I've done till now:
I have installed the latest Win7 SDK (Link)
I am targeting .net 3.5
I've tried playing with the Platform Toolset Property - but it was just playing
In my solution there is a managed C++ Assembly (my Problem)
I am using MSBuild 4.0 because the new VS2010 project files cannot be compiled with MSBuild 3.5
I am using CC.NET. compilation fails in CC.NET and on the command line. So it should not be a CC.NET issue.
Are there any tips and tricks how to configure my project properly to compile on my dev machine with VS2010 and on my build server? Is there anything more to install (except VS2010)?
Thanks, Arthur
For now, installing VS 2010 is your only safe option. The Windows SDK will be updated to enable your scenario, but I don't have a specific release date. Until then, you'll need to install VS 2010 with the C++ tools in order to build your 2010 solution with C++ projects. Make sure you let the C++ team know about how dissatisfaction with this situation via their team blog and/or MSDN Forum.
Even after installing VS 2010, you may need to invoke the appropriate vcvars*.bat file to setup your environment variables correctly.
Why don't you want to install VS2010 on your build server? If it's licencing, it's licenced per developer head not per install so I'm reasonably sure you are allowed to without buying another copy - or, at worst, you can install the express version which ought to at least install the config bits you're missing so you can use the platform SDK compiler.
If you're still having problems with msbuild you can then use devenv.com /build which exactly replicate the VS build env.
You may try those links:
http://social.msdn.microsoft.com/Forums/en-US/tfsbuild/thread/9055ca52-586b-459f-9dd1-a9d052d076b9/
or
http://msdn.microsoft.com/en-us/library/ee662426.aspx

ClickOnce: getting MSVCRT C++ DLLs on user's machine

I've been trying desperately to get my application (15 C# dlls and 1 C++/CLI dll with C++ Runtime DLL dependencies) to deploy with ClickOnce. I got it to work by just copying the Release folder, but ClickOnce refuses to copy the files (msvcm80.dll, msvcp80.dll and msvcr80.dll) and deploy them in this folder.
I did this nutty workaround (supply msvcm80.dll, msvcp80.dll and msvcr80.dll as Content/Copy If Newer and then at startup, create the Microsoft.VC80.CRT folder, copy those DLLs, and create Microsoft.VC80.CRT.manifest) that seems to work, but this all just feels wrong to me.
Am I missing something?
I'm stupid: I just found this:
On Publish tab of Properties page of my startup project: click Prerequisites... button > check Visual C++ Runtime Libraries, radio button setting: Download prerequisites from the component vendor's web site.
It seems to work the way one might expect!
There should be a msi from microsoft that deploys those for you. I used....
instructions
and download vcredist_x86.exedownload