Embed Resource Files into C++ Executable - c++

I'm running into a strange issue when I compile a release package for a C++ application I am writing for work. Inside the IDE(Visual Studio 2017 Community Edition), when I compile and run the application, it runs fine and finds the missing resource file. When I compile with the IDE, go into the file manager, go to the output directory, and try to run the compiled EXE, I run into an error that says "Failed to load icon from the file 'foo/bar/dumb.ico' (error 2: the system cannot find the file specified.)'
Is there something I need to do with my IDE so the resource files are embedded into the EXE so I can distribute them around the office?

Related

exe file is not running in Release folder

My project IDE: Visual Studio 2019, Qt 5.15.0.
I'm trying to launch the application by the project_name.exe file of the release build, but nothing happens.
The project_name.exe file of Debug mode is running well.
The project is running well also in IDE in both Debug and Release modes.
I added Qt Bin directory to the PATH.
I tried windeployqt command but it didn't help.
I copied to Release folder all the dll files the application depends on, according to the build output and Dependencies tool, but then I couldn't run it neither from the exe file nor from the IDE (there are no any compilation errors or error messages when I'm trying to run it).
What is missing for running the exe file from Release folder?
The following steps finally solved my problem:
Copy the qml folder from the project directory into Release folder (it has to be
near the exe file).
In Release folder launch Command prompt and write: windeployqt project_name.exe,
this step must come after having qml files for getting the whole needed deployment
files by windeployqt command.
Copy from your system the following dlls into Release folder: opengl32.dll,
libcrypto-1_1-x64.dll.
For a VM with no Visual Studio installed there are some more dlls to copy.

Loading File works in compiled exe but not when run inside visual studio

I am trying to load an image into my program using stb_image. Every time i run the program directly inside of visual studio (pressing f5, happens in debug and release) the opening of the File fails. If i run the compiled exe in windows explorer the loading works just fine. The same problem occured when using fstream to load a textfile into a string.
I tried placing the files in the directory of my code and into the final build folder but with no different outcome. Running Visual Studio with different Rights and different build settings.
Using absolute paths in the loading function fixed the problem.

Visual Studio 2017 C++ built executable refuses to launch on another PC

I have a C++ project in Visual Studio 2017, which I built an executable file from, using the answer from this question found on MSDN , the .exe was built successfully, but when I copy this file to another PC and try to launch it, it returns me an error message, which says that launching of this app is impossible, because libcurl.dll is absent, what should be done, for avoiding this problem ?
Here's the preset which I'm using for .exe creation
P.S.
If it is of any help, when I created the project, I've chosen Empty Visual C++ Project.

Visual Studio - lib is not a valid Win32-Application

I want to run the opensource C++ library "VRPH" on VS 2015 (http://www.coin-or.org/projects/VRPH.xml).
I successfully perfomed the "make" command using cygwin/g++. Doing so leads to some more folders in the VRPH directory.
As described in the install.txt I openend the file VRPH.sln with Visual Studio.
Now VS does the "migration-process" and fires an UpgradeLog.htm with lots of warnings in it (mainly because of the software was created on a 2008 VS-Version), but no errors!
If I now click on "Local-Windows-Debug", the Debug-Window informs about serveral compile processes and the main project "VRPH" creates a VRPH.lib in the Debug-folder.
Having done that the Debugger says: "VRPH.lib is not a valid Win32-Application"
Any idea what to do?
Thank you so much for help!!

Visual Studio 2012 does not generate exe

I've a C++ project in Visual Studio 2012 Express, and I started having problems lately. When I compile the project it works, nothing wrong, however when I try to execute it the .exe disappears. I mean, I compile the project, the project generates the exe file with no problems, but if I try to execute it from Visual Studio or directly from the output directory, Windows say to me:
Cannot start the program 'C:\Users\Adrian\Dropbox\MyApp\Debug\MyApp.exe'.
The system can not find the file specified
If I create another project, Hello World for example, there is no problem and the exe generates and executes good. So I guess the problem is specific to my project. I tried disabling Avast (because maybe he delete the file) and the problem persists.
Also I create another project, including the files and... the problem is still here...
I check the project options, specifically general and debug options and I see nothing wrong.
So does anyone have an idea what may be wrong?
The output directory is $(SolutionDir)$(Configuration)\ and I'm compiling in Debug mode.
The windows error message is misleading. It should state that, loading a library (dll) failed. You might run the program with a process monitor (see: http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx)