My Qt5 executable does not run outside of Visual Studio 2010 - c++

I have done a big project with Qt5 and visual Studio 2010. Everything is well inside of visual studio using the run button.
But my goal is of course to release it to other persons, without visual studio.
My problem is: I can't get the .exe run outside of visual studio. I was asked for several dll's at first, I found them all in the Qt5 bin folder.
But know I got rid of those messages, when I wan't to open my exe, nothing happens.
Just nothing.....
I cannot even find my exe in the windows task manager.
Does someone here know an answer to that issue?

There are dll files that are loaded during runtime and don't give you any error, warning or whatsoever when not present (also totally transparent to dependency walker). Such is the platforms\qwindows.dll - note that it must be in a platforms\ subfolder relative to the executable. You might also be missing libEGL.dll and libGLESv2.dll.

Dependency Walker is not very useful in this case as it shows very strange dll files missing: API-MS-WIN-CORE-PRIVATEPROFILE-L1-1-1.DLL etc.
You can use Qt5.x cmd prompt ( 5.x is the version that you are using) and run windeployqt.exe from your build directory. It will automatically find and copy all necessary dll files to your output directory.

Related

Missing .dll in different Visual Studio versions

I recently came up with an issue. I had a project created on visual studio 2015, using allegro5 library which executed on Debug and Release mode correctly.
When I changed visual studio versions though and started using 2019 version (In the mean time I had to format my PC and re-installed only VS19) and loaded the project, the execution had a missing msvc110d.dll error shown up.
I tried to find a way in order for my project to be "upgraded" and instead of looking into the old version of msvc to try and look up the newer version, but couldn't find anything.
So is there a way for me to change some settings in order for my project to expect newer versions of msvc, or do I have to create a new project and copy paste all the configurations and files/assets inside that new project?
Thank you all
P.S I know that the error can be resolved If I get the .dll file inside that directory, but that is bad practice for sure. Also could you give me a tip on how to setup a project correctly in order to prevent those kind of issues in the future?
I think you need to find the VS2015 redistributable on Google and install it on your machine. That should solve it.
Windows dynamic library files are installed under c:\windows\system32 directory. A 32 bit dll file in a 64 bit windows can be found under c:\windows\syswow64. When your VC++ developed application searches for the dll it first checks in the application folder and then the system folder. If it is not found in these locations, a "missing dll file" error will be shown.
Normally, installing the right VC++ redistributable does the trick. But at times the mismatch persist as the sdk you're using is not in conformity with the system dll. You shouldn't replace the existing dll in the system directory manually with a downloaded( download only from www.microsoft.com) one as other installed software may also failed in the process.
In such worse case scenario, you can however directly copy the downloaded dll files in your application folder itself and distribute along your software so that it runs on a remote host too. Normally these compatible dll files, for both debug and release versions, are also available in your VC++ sdk directory which can be copied for a perfect match.

C++ program not running on windows systems without VS installed "VCRUNTIME140.dll was not found"

When I compile a simple program:
#include <iostream>
using namespace std;
void main() {
cout << "Hello world!";
}
And tun the compiled .exe on another system without visual studio installed I receive the following error:
The Code execution cannot proceed because VCRUNTIME140.dll was not found. Reinstalling the program may fix the problem.
When I compile with cl.exe I receive no errors,
does anyone know a workaround to this without installing VCRUNTIME140.dll on the systems. (I've tested on multiple windows systems including a windows virtual machine)
I've encountered this problem before and there's a simple solution to it,
The missing .dll are a issue of static linking not missing packages (in most cases),
becuase visual studio 2019 comes pre-installed with what you need.
To fix:
go to your project properties (in project tab)
Select C/C++
Change the value of runtime library to "Multi-threaded debug (/MTd)"
This will cause the compiler to embed the runtime into the app.
The executable will be significantly bigger, but it will run without any need of runtime dlls.
Get the "Visual Studio 20xx VC++ Redistributable package" for your version of Visual Studio. Then run on the target machine to install.
Bottom of this page: https://visualstudio.microsoft.com/downloads/
Or bottom of this page for older versions of Visual Studio: https://visualstudio.microsoft.com/vs/older-downloads/
I've had the same problem, mainly because originally when compiling something with C++ and turning it into an exe file, it's still gonna be an exe file that depends on libraries from C++.
But according to asd plourgy, who had a good idea to change the value of the runtime library, I wanted to share with whoever seeks knowledge how I solved it:
Go to your Visual Studio Code and follow these steps:
Click on Project
Properties
Scroll out C/C++
All Options
runtime library
Change value to: "Multithreaded-DLL (/MD)".
And that should do the trick. Afterwards, you have to obviously
save
debug
create new(exe)
open cmd and run the exe to make sure it works.
My System is: Windows 10
Here are a few pictures to make the steps easier, it's in german though:
step1:
step2:
step3:
step4:
step5:

exe generated with Visual Studio creates dll errors on other pc's

I wrote a programm with Visual Studio, that i wanted to share with some friends. But when taking the complete folder containing the debug folder containing my .exe file and sending it to friends it throws 3 errors:
missing vcruntime140.dll
missing MSVCP140D.dll
missing urctbased.dll
(the order is probably not correct)
We tried to reinstall/update Microsoft Visual C++ Redistributable 2017 x64 on this page, but without any positive results.
Might this be a problem, that I'm using the SDL2 library? I copied the SDL2.lib into their Syswow64 folder and system32 folder, which removed that specific .dll error, but made the others first appear.
Choosing Realese option before building project and then sending the whole Release folder to your friends should solve this problem.

Unable to load dll libglorycolx2010.dll. The application has failed to start because its side by side configuration is incorrect. HRESULT: 0x800736B1

I am using a third party dll, libglorycolx2010.dll in my C++ project. When i try to run the project i get the above error.
Many sources online suggested that i install Microsoft Visual C++ Distributable package which i have done. The problem is, i am not sure which dependencies are required by the dll. In that case i installed all versions Microsoft Visual C++ Distributable packages (2005,2008,2010,2012) X86 bit, but the problem still persists. I am using DllImport to load the library and i am using Visual Studio 2012 Professional.
I also tried to register the dll using regsvr32 but still got the same exact error. Kindly someone help.
Use dumpbin command using visual studio command prompt to analyze the libglorycolx2010.dll. This will analyze the dll and display all the dependencies of the dll.
Go to system32 folder and search for all the dependencies that were displayed using the dumpbin command.
There is a likelihood some may be missing. Go to https://www.dll-files.com/ and search for the missing dll and download it, then copy it to system32 folder.
Try running the Project again.
Usually when I get this error, it means that I am trying to load a 32bit dll into a 64bit application, or a 64bit dll into a 32bit application.

Deploying a c++ QT5 app

I am trying to deploy my application. It works on Windows 7 with quit a lot of .dll files but I can't get it work on Windows XP. It seems that windows Xp requires more dll files. But the Dependency walker tool keeps showing me new dll files missing. Now it says API-MS-WIN-CORE-PROCESSTHREADS-L1-1-0.DLL and API-MS-WIN-SECURITY-BASE-L1-1-0.DLL are missing.
When i try to start the exe nothing happens ... no error...
I use Qt5.0.2 with pre build msvc2010.
Thanks in advance
Perhaps this is related to missing VS 2010 redistributable? Also make sure to build in a release-configuration if you don't already know.
http://www.microsoft.com/en-us/download/details.aspx?id=5555
If you package this up into an installer like NSIS, I'd typically execute it with the argument /Q to prevent any GUIs from popping up... it won't ask for any admin privileges which is nice since the previous VC 2008 redistrib always required it.
As the previous answer a requirement is the VS redistributable. In your case, as you use VS2010 the file to download is MS 2010 redistributable.
Besides of that there is the executable windeployqt that helps with the deployment package copying the Qt DLLs required on your executable directory.