Qt5 create an exe file - c++

I'm trying to create a Qt5 executable on Windows, when I built the project from QtCreator and went to the build folder and started the .exe I received a lot of missing library errors, and I fixed it using windeployqt:
>C:\Qt\5.15.2\msvc2019_64\bin\windeployqt.exe App.exe
Then I had another problem:
The application was unable to start correctly (0xc000007b).
And I simply solved it by installing Visual C++ Redistributable Packages for Visual Studio 2013. But now if I try to start it it gives me an error:
The code execution cannot continue because libwinpthread-1.dll was not found.
Does anyone know how to fix it? Thank you.

There's a description for this process (which is called deployment) in the Qt manual, e.g deployment with windeployqt, you might also look at the Qt Wiki for manual deployment.
BUT: It looks as though you mixed up something in you application: Visual C++ Redistributable Packages are needed in case you compile your application with Microsoft compilers. libwinpthread-1.dll is needed in case you compile your application with mingw compiler.
Make sure that you are using the same compiler/linker for all libraries, sources and the pre-built binaries from Qt.

Related

Trouble generating a deployable binary for a C++ wxwidgets project using Visual Studio

I’m having trouble generating a deployable binary for a C++ wxwidgets project using Visual Studio. After the build completes, the exe that is generated does not seem to get installed in any other Windows machine.
Visual studio 2019 is used to create GUI library with openCV included in it. I’m trying to create a standalone executable .exe to run it in any other Windows computer without installing visual studio or opencv in it.
Earlier, while opening the executable file in other computer, it gave error that dll’s are missing for openCV and wxwidgets. So, I have copied the required dll’s from the directories of openCV and wxwidgets bin folder. Now, when I try to execute the exe file, it shows the following error. Kindly help me to resolve this issue.
Applications built with the C/C++ runtimes dynamically linked (/MD[d]) require the appropriate x86 (32-bit) or x64 (64-bit) VC++ redistributables on the target machine. They can be installed from The latest supported Visual C++ downloads, or they can be included alongside the application for local deployment.
Also, be sure to only send out non-debug (Configuration = Release) builds.
MSVCP140D.dll
VCRUNTIME140D.dll
VCRUNTIME140_1D.dll
ucrtbased.dll
The 'D' suffix in the names of those missing DLLs stands for "Debug". Those are the debug C/C++ runtime DLLs, which are used by the Configuration = Debug builds, and are installed as part of the Visual Studio setup. They are to be used during development, but not otherwise deployed, per Determining Which DLLs to Redistribute:
Debug versions of applications and the various Visual C++ debug DLLs are not redistributable.
It also seems that you are using DLL build of wxWidgets and you build OpenCV as DLL.
If you yourself does not create a DLL and your software is one self contained binary ou will be better off using static linking wxWidgets and OpenCV.
And on top of what #dxiv, not everything in MS CRT can be used statically linked. That's why it is strongly recommended to install MS CRT by creating an installer, which should take care of all those dependencies.
HTH.
Thank you.

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.

MSVC2013 - Entry Point Not Found

I recently installed the Qt add-inn for visual studio 2013. When I build a project in either Qt Creator or Visual Studio using MSVC2013 it builds without errors, but can only be run from inside the IDE. If I try to run it by clicking the .exe, it gives an error: "The procedure entry point ?qt_metacast#QMenuBar##UAEPAXPBD#Z could not be located in the dynamic link library".
From the research I have done online, I found that it could be something to do about adding the correct .dll files in my .exe directory. Which .dll files do I need or is there something else I'm doing wrong?
I installed the Visual Studio Add-in 1.2.4 for Qt5 from the Qt website.
DLLs for this kind of libraries use to be unnecessarily big. You should make a Qt static compilation so that your needed functions are embed into your *.exe.

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.

I can't run openCV2.3.1 with VS2010 because opencv_core231d.dll was not found

I installed openCV2.3.1 with VS2010. In VC++ Directories I set Library Directories to C:\opencv\build\x86\vc10\lib. My code has no error but when I try to build it VC++2010 displays this error
This application has failed strat because opencv_core231d.dll was not
found. Reinstall the application may fix this problem.
How do I setup openCV2.3.1 with VC++2010 to find the .dll?
Have you seen Microsoft Visual Studio tutorial from the latest OpenCV documentation?
You need to build the openCV2.3.1 yourself. We use cmake build tool in our project. And you should copy the opencv_core231d.dll to your exe directory so that your executable file can find the dll.
Here is the Complete Installation guide for OpenCV.
Download and install the 2.3.1 superpack for Windows and configure Visual Studio according to this post. Even though the instructions are for the 2.3 version, the procedure remains the same and you just need to take care to use the appropriate paths and file names of v2.3.1 when following the steps.
Alternatively you could try to follow Andrey's recommendation, but I haven't test it yet.