PDA

View Full Version : Microsoft Visual C++ Runtime Library problem while running app outside QtCreator



Momergil
25th November 2013, 12:47
Hello!

I'm having some trouble trying to run my new app outside QtCreator in all tested computers besides my home's one, where everything works fine.

To be more precise, each time I try to run the .exe outside Qt Creator using Qt 5.1.0 compiled dinamically with MinGW in a folder where all the necessary dlls are included - as far as I know, that is, as far as Windows and my experience with Qt tells me) the same "Microsoft Visual C++ Runtime Error" appears.
In one of such computers I even have Qt and everything else installed and even trying to run a basic mainwindow software doesn't work - so I know that this is not a consequence of my new app having more complexity; no software done in Qt is working in this machine. I also installed some other software previously done in Qt that worked quite well and they don't work here for the same reason.

Trying to solve this problem, I installed the Microsoft Visual C++ Runtime lib on the mentioned computer, without success. Doing some research I found the thread http://www.qtcentre.org/threads/53228-Qt5-Microsoft-Visual-C-Runtime-Library-error , where Chris suggest that mingwm10.dll is lacking. Indeed, I don't have this file on the folder but Windows don't warn me about that and neither I could find it in the Qt installation folder.


So why is any Qt based app being prevented to run outside Qt creator in this PC I'm trying to? Remembering that at home, everything runs fine, and this PC does have Qt installed.


I'm glad for any help,

Momergil

d_stranz
25th November 2013, 22:47
Do you have the file "qwindows.dll" installed in a "plugins/platforms/" subdirectory of the directory where your other DLLs and EXE are located?

Are you mixing Visual C++ and MinGW DLLs? Everything has to be from the same compiler - EXE and all DLLs - you can't mix and match.

Momergil
26th November 2013, 00:33
Do you have the file "qwindows.dll" installed in a "plugins/platforms/" subdirectory of the directory where your other DLLs and EXE are located?

Are you mixing Visual C++ and MinGW DLLs? Everything has to be from the same compiler - EXE and all DLLs - you can't mix and match.


Thanks d_stranz for the reply.

No, I don't have such file and never needed it in any Qt installation - and in my PC I don't have such file in the mentioned subfolder and it works well. The only place I found it was in Qt Creator's bin directories. Should I try with a copy of that one?

I'm sure I'm not mixing Visual C++ and MinGW dlls - I don't have Visual C++/visual Studio/MSVC neither in my computer at home, nor in the other, mentioned computer; all Qt installations where allways performed using MinGW as choosed compiler.

d_stranz
26th November 2013, 03:57
You *do* need it. This is a change from Qt 4.x. The reason you don't need it on your development PC is because QtCreator knows where to look for it (in your Qt install directory) and automatically loads it at run time. They made the change in Qt 5.0 because now the core library has no dependencies on the platform - all that has been moved to the platform DLL.

So, in addition to the normal Qt and other DLLs you need in the executable directory, you need to also install the qwindows.dll. I was slightly wrong in my last post; it needs to live in ./platforms/qwindows.dll relative to the exe directory. See this article (http://qt-project.org/doc/qt-5.0/qtdoc/deployment-windows.html).

Momergil
26th November 2013, 17:54
You *do* need it. This is a change from Qt 4.x. The reason you don't need it on your development PC is because QtCreator knows where to look for it (in your Qt install directory) and automatically loads it at run time. They made the change in Qt 5.0 because now the core library has no dependencies on the platform - all that has been moved to the platform DLL.

d_stranz, thanks very much for the explanation; I was totally unaware of this information. I'll try that solution as soon as possible and return with the feedback.

Momergil
27th November 2013, 21:43
Yes, it did actually work; that was the problem.

Thanks d_stranz once again!

Momergil

d_stranz
3rd December 2013, 04:05
Sure. It took me a lot of head-banging and hair-pulling before I figured it out.

It is sort of disappointing that since the move from Nokia to Digia / qt-project.org so much of the documentation seems to have been turned over to user-contributed articles which aren't being kept up to date or indexed for the current release. Most of the time when you use the drop-down link to select the version of Qt you're working with, you end up on the main documentation home page for that version, and no way to search effectively. For example, the link I gave you was for Qt 5.0. It you chage the version to the current Qt 5.1 release, it drops you onto the 5.1 documentation home page.