fltk, opengl, textures and SOIL in visual studio 2013 - c++

I have made an application in c++, using FLTK 1.3.2 on Mac OSX and am happy with its functionality and now need to produce a Win32 version (a motivating reason for using FLTK)
I can get basic FLTK code to run on Windows now, but have come up against several issues:
1) Despite building my project as a release version whenever I launch the application is launches out of a command prompt. How do I stop this?
2) On Mac all resources can be included in the app bundle and then loaded as files from the app bundle path. Is seems that there is no equivalent in Windows; I have to include images (for instance) as a resource. The problem is that two distinct bits of functionality need a path to the image I want to use namely:
a) Fl_PNG_Image class where the syntax is Fl_PNG_Image a_guide("path/myfile.png");
b) SOIL image loader where the syntax is texture= SOIL_load_OGL_texture("path/myfile.png", SOIL_LOAD_AUTO, SOIL_CREATE_NEW_ID, SOIL_FLAG_MIPMAPS);
I want just a standalone application without the need to bundle folders with resources that need to be in the right place. How can I include files as a resource in Visual Studio and then use the with SOIL/Fl_PNG_Image and if not what else would people normally do in such a situation?
Thanks.

Related

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.

How does one deploy a VS, C++, OpenGL application to a second computer?

I am trying to simply deploy an OpenGL, C++ application from one computer to another. The app was written using Visual Studio 2017 Community. The first computer has VS installed, the second does not.
The computers have Intel Core i7-8550U CPU and Intel Atom x5-Z8350 CPU, respectively. Both are running Windows 10 Home.
The VS project started as an empty project to which I added everything.
I have copied the release, x64 application .exe file and the one .dll file necessary to the project development to a single directory on the second computer.
Microsoft instructions for local deployment say “Local deployment, in which you copy particular Visual C++ DLLs from your Visual Studio installation—typically in \Program Files (x86)\Microsoft Visual Studio version\VC\Redist\platform\library\—and install them on target computers in the same folder as the application executable. You can use this deployment method to enable installation by users who don't have administrator rights, or for applications that can be run from a network share.”
Nothing I can see or find to set in VS tells me what .dll files are being used by the application I developed and run on the first computer. There is a VS output window that shows a number of .dll files, but those are in c:\windows\system32.
From the reference in the Microsoft instructions regarding the MSVC DLLs in \Program Files (x86)\Microsoft Visual Studio version\VC\Redist\platform\library\, I looked in ..\VC\Redist\MSVC\14.16.27012\x64 on the first computer and found these folders:
I have copied the DLLs from the .CRT directory and the .MFC directory to the second computer to no avail.
When I try to run the application on the second computer it displays the message “Failed to create GLFW window”, which is in the code I wrote as shown here:
It would seem that there must be a straightforward way to do this. I have seen reference to an old Microsoft application (I think), depends.exe, which provides the a list of the DLLs required, but it is no longer deployed with Windows systems.
missing DLL or RTL
causes crash or even no error but just instant closing your app (that is what missing or miss-matching MSVCPP RTL is doing or was at some point).
As the RTL libs are changing all the time (IIRC once in a year) there are a lot of versions already so good luck using MSVCPP apps on fresh OS computers. In order to use some app you usually need to find out which version of RTL it needs which they usually do not report so you will end up with installing all of them you get hands on ...
There is a way around this problem just enable your compiler/linker to link all the stuff it needs directly into exe file instead of using RTL DLLs. However I do not code in MSVCPP and from what I heard MS removed this option from their environment (other compilers I use still have it)
Your error message indicates your App run as should and is not missing anything.
The problem is on GL side. Windows 10 is usually forcing wrong drivers (and not just for gfx cards). The goto case is enforcing (most likely intentionaly) buggy MS drivers (where GL is bugged and DX more or less works) instead of vendor provided. To remedy this (check the driver manufactor and if not what it should be) download&install correct driver from your gfx Vendor site Do not use Windows Driver service for gfx cards !!!
You can use DUMPBIN /DEPENDENTS EXENAME to get a list of bound DLLs. Mind you this only lists DLLs with import table entries, if you're instantiating COM objects this won't help at all.
My guess is you're probably missing the opengl driver/dll on the target system.
ed: actually I'm going to narrow that down to missing the driver, since if you were missing the DLL you'd have gotten an an error on load. The fact you're able to call the function means you bound to it, but that you're only getting failures when it tries to call the driver. Try calling something benign that queries for driver or device info, like a version or string. If that fails you know the driver is missing.

Problems with OpenCL (opencl.dll, AMD APP SDK, cl.h)

I'm trying to work with OpenCL in Visual Studio and here's what's bothering me:
I have an ATI graphic card and so I downloaded AMD APP SDK, the latest version 3.1, and wanted to start developing on some example but got stuck because there was no "cl.h" nor CL folder for that matter in that SDK. I found that very strange, since in all the examples Ive seen the include was: #include . Then I downloaded an older version, I think its 2.7., and there was CL folder with cl.h file as well. I then also made sure all the library dependencies and include directories are set in the project properties and when i tried to run an existing OpenCL project there were no errors reported. However, when the program started it crashed because it was saying that "OpenCL.dll is missing". I looked in the SDK folder for the file and it wasnt there. I then downloaded opencl.dll from internet and copied it into debug folder and tried to start the program again but it crashed again with a message "Opencl.dll is either not designed to run on Windows or it contains an error.".
Im really lost here and would appreciate any kind of help!
Ideally you shouldn't download "Opencl.dll" explicitly, it should come as part of your drivers installation. Header files & Lib files can be part of SDK, but run-time files like "Opencl.dll" are not necessarily be part of SDK. Crash can be observed if there is no compatibility between the SDK files (Headers and libraries that you use for your application) and Run-time files (Opencl.dll).
So, make sure to update drivers corresponding to the SDK version that you use.
Also, the opencl.dll generally get placed in "C:\Windows\System32" & "C:\Windows\SysWOW64" when you install the drivers. Generally, this is the one that gets used during run-time

This application failed to start because it could not find or load the Qt platform plugin "windows"

I tried making an executable file of my program but there are some errors which I did not understand or could not find solutions of. I used my .exe file onto another computer and there was an error. I made my program through QtCreator (v 5.1.1)with my Windows 7, 64-bit laptop. There was an error when I used it in 2 32-bit laptops.
The error message says:
This application failed to start because it could not find or load the Qt platform plugin "windows".
Available platform plugins are: minimal, offscreen, windows.
Reinstalling the application may fix the problem.
I already created a new folder called "platforms" containing "qminimal.dll", "qoffscreen.dll" and "qwindows.dll" in the same level of my .exe file. I also pasted in the same level the other DLLs that my program needs.
In Qt 5.2, there is a tool that can be used for deployment on Windows: windeployqt. It will be in the bin folder of your Qt installation. It greatly simplifies deployment, so if you don't mind downloading a newer Qt version, I'd highly recommend it. It may even work with an older Qt version, but I haven't tested it.
We had exact same problem with Qt5.3.
Problem arised when we've rebuilt the Qt to reduce dependencies (e.g. Qt5Positioning, Qt5Sensors).
Created dlls were copied to different directory (source for installation), but we forgot to copy also newly created platforms plugin dlls.
The problem was fixed by using all dlls from same Qt build (with same configuration).
Your problem is probably the same: mixing dlls from different Qt builds (e.g. different configuration, version,...).

How to create a release built of Win32 C++ app that uses lots of libs and not only included in VS environment headers?

So I created an app (with lots of help from SO and my friends). It compiles and runs on my machine (I tied to place it into different folders). VS created for me a debug older with my app : HelloVideoStreaming.exe some HelloVideoStreaming.ilk and HelloVideoStreaming.pdb. Problem is - when I try to run my app on another computer OS stups it from working saying that something about its parallel configuration is wrong.
I used Boost (used .lib libs), FFmpeg (Libs and DLLs ere linked into VS), OpenCV (I had it installed (installerfrom official open CV site) on my development computer) and OpenAL (I had it installed (installerfrom official open CV site) on my development computer).
Some of headers are included in VS some in project (via project properties)
How to make VS put all needed to deploy/run my app on other computers into one place? some folder like bin or somthing like that...
Do you mean "side-by-side" configuration is flagged as incorrect? You have to make sure that the runtime libraries you built with are available on the target machine, also any third-party DLLs that you need, though it sounds like you tried to use all static libraries there. For info on how to run VC++ apps from VS2010 on a machine that does not have VS 2010, see here - there are similar links for other compiler versions.
Please clarify the question if this is not the error you saw.