Why is my QT application not working?

梦想与她 提交于 2020-01-14 08:49:05

问题


I built a Qt 5 application using Qt Creator on Windows 7 64 bit (using msvc 2010). The application runs perfectly on my computer but it won't work on other computers.

I copied all the .dlls which were shown as missing in Dependency Walker into the program folder and there is no error, but the application just won't run.

I've tested it on Windows XP and Windows 7 64 and 32 bit.
What can I do in order to find out what's wrong?

UPDATE: i installed Qt 4.8.4 (vs 2008) and msvc 2008 express and i compiled it and it's runs on other computers, with the .dlls of Qt4. maybe someone know what the problem with Qt5...


回答1:


I had the same problem.

You need to include the "platform" directory containing qwindows.dll and qminimal.dll in your executable directory. You can find the directory under the "plugins" folder.

If you don't add this, your application will appear to load and then exit with return code 0. Dependency walker cant help you because the DLLs are delay-loaded.




回答2:


I had the same problem - I'd added all the DLLs reported by Dependency Walker, but my program exited immediately with no error message when run.

I added libEGL.dll to the program directory and it now runs normally.

I'm guessing that libEGL.dll is loaded dynamically by one of the other DLLs - probably libGLESv2.dll, on the basis that of all the known dependencies it has the most similar name (!) - and that dynamic loading is not something that Dependency Walker can detect.




回答3:


I experienced the same issue as well and learned that MinGW GCC 4.7 is not compatible with Qt 5.0 and above from this this post. I took the same approach as you did and switched over to Qt Creator 4.8 which worked.




回答4:


I also had the same problem and tried with both DLL missing messages & Dependency Walker, and it didn’t helped me or I don’t know whether I used it properly. The below method helped me to solve (For the given scenario) it. This method will work to some minimum cases.

Scenario

  1. QT Creator 3.3.2
  2. QT 5.4.1 (MSVC 2010, 32 bit), Windows 8.1 OS
  3. Used no dynamic loading of dll's
  4. Used no third party dll's
  5. It’s a QTWidget application.

Method (Tried for both kit MinGW 32 bit & MSVC2012 OpenGL 32 bit)

  1. Get the release exe after building the application. Copy and paste to another folder where we want (Assume as Z:\abc)
  2. Go to the Qt kit (MinGW OR MSVC) installed folder (In my case : Z:\Qt\5.4\mingw491_32 (or) Z:\Qt\5.4\msvc2012_opengl)
  3. Search for *.dll
  4. Copy all the DLL and paste it to the exe placed folder. That is (z:\abc)
  5. Run the application (In my case it started properly).
  6. While running the application, delete all the copied DLL file's.

    6.1) While deleting, windows will show prompt for the DLL files which are being used by the application (File in use), as those DLL's were loaded initially. Leave those files as it is.

    6.2) And other DLL files will get deleted as we requested.

  7. Close the application and reopen it (In my case it started properly).
  8. So here we got the needed DLL's

This is not a proper way, but it may help in some cases.

Note

While copying all the DLL's, when getting file already exist message, keep both the files in different names as system decide. If the application wont runs, then we can try with these renamed files.



来源:https://stackoverflow.com/questions/14370111/why-is-my-qt-application-not-working

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!