Deployment with MSVC2015 compiler
I have already successfully deploy Qt applications with MinGW on Windows XP,7,8,10. However, for a particular application I need to use the MSVC2015 compiler (I use Qt 5.9.2 on Win8).
I build the application with Qt and directly use the .exe it generates. I included all the Qt dependencies. However, when I run my program on a Win7 machine, there are some dll missings (msvcp140.dll, concrt140.dll, vcruntime140.dll). These are all dll my Win8 machine has in C:\SysWOW64. When I run ProcessExplorer on my Win8 machine to see the dll dependencies, there are many dll in SysWOW64.
What I did is that I copied the 3 missing dll from my Win8 machine from C:\SysWOW64 to the .exe folder. It works.
However, I am not sure it's a good way of doing it...Also, I am afraid that another computer would need more dlls or something from C:\SysWOW64.
Thank you very much,
Do you mean: the file exists on the Win8 machine where you installed MSVC2015 compiler to do your work, but not on a Win7 machine where you did not install compiler?
And also btw, are you indeed compiling for 32-bit (rather than 64-bit)? What 32-/64-bit-ness are the Win8 & Win7 machines?
@JNBarchan Good questions, sorry I didn't directly mentioned them
- Yes, I meant C:\Windows\SysWOW64
- I exactly mean "the file exists on the Win8 machine where you installed MSVC2015 compiler to do your work, but not on a Win7 machine where you did not install compiler?"
- Yes, I am compiling a 32 bit application. It must be a 32 bit app. My Win8 is 64 bit, my Win7 is 32 bit
OK, so although I know nothing about how " I included all the Qt dependencies" works, I can tell you those files are the MSVC2015 C runtime libraries. They are needed on any target machine.
On your Win8 machine you have them because you installed the compiler, and they would have come with it. On another machine they may well not be there. You have to ensure they are distributed and installed with your app, because it needs them.
I don't know how you "deploy" Qt apps, whether it's supposed to bundle these with some "installer", when it comes from MSVC. But that's what those files are.
Perfect, thank you.
For the Qt Dependencies, I used windeployqt to get all Qt dlls and necessary files.
I just wanted to be sure there was no other files I would need to distribute and if the way I did it for the 3 dlls (*140.dll) was ok (simply copying from C:\Windows\SysWOW64).
I would have expected your "windeployqt" to get it right, but I don't know. If it's supposed to include all runtime files. But remember these are specific to MSVC, not MinGW, so I don';t know how it knows that
You should not have to copy these over yourself. Indeed you must be careful, because your versions could be older than versions on some machines. So you do need a "proper" solution to this. maybe someone else will answer....
If you only want it for yourself, and don't get a better solution, at least Google for "install MSVC 2015 runtime distributables", there will be a download to do it properly, don't just copy the files across yourself
I think windeployqt only manage Qt dll and files. It did not copy neither dll for opencv or other libraries I use. My solution should work on any computer so I would appreciate to know the "good" way to do it without my users being in the obligation to install MSVC distributables.
install MSVC distributables
OK, look at http://doc.qt.io/qt-5/windows-deployment.html, you'll see it's talking about at least some of your files there:
In addition, the archive must contain the following compiler specific libraries depending on your version of Visual Studio:
VC++ 12.0 (2013) VC++ 14.0 (2015)
The C run-time msvcr120.dll vccorlib140.dll, vcruntime140.dll
The C++ run-time
@JNBarchan oh thanks, I read this page but I didn't see that, thanks !
So I guess it's OK if I just copy them from my C:\Windows\SysWOW64 folder...