5

I have a qt c++ plain program. using mingw8.1 gcc as compilier in windows.

I can run it in qt creator.

But when i want to use windeplotqt to deploy, it failed with:

a.exe does not seem to be a Qt executable

my step is:

1. copy the exe from build-xxx-release/release/a.exe to a clean folder
2. open terminal from QT(mingw) from my windows start menu
3. cd the clean folder in terminal
4. windeployqt a.exe

then the error come out.

It driven me mad, because i reinstall QT for many times. I can ensure my qt is a clean environment.

Can anyone help on this?

nick
  • 832
  • 3
  • 12
  • can you show your command? – bogdyname Apr 10 '21 at 05:56
  • windeployqt a.exe (a.exe is my executable file) – nick Apr 10 '21 at 10:46
  • Why do you coy the exe at all? Do you call the correct windeployqt.exe (correct architecture)? – chehrlic Apr 10 '21 at 14:38
  • @chehrlic i read a blog, it tolds me to copy the exe file in a single folder, then run windeployqt. I think i am using the correct one, because i only have one QT version(QT 6.0.3 with mingw 8.1) – nick Apr 10 '21 at 15:28
  • In order to run windeployqt, the application needs to be of Qt application. This means that it needs to import a qt header. Try to `#include` in the main.cpp and create a tmp variable `QString tmp("")` in the main function. This will meet the requirement I think. – slayer Apr 28 '21 at 03:23
  • 1
    Don't reinstall Qt. It's never a problem. – Kuba hasn't forgotten Monica Jun 07 '21 at 14:54

1 Answers1

2

maybe you use the wrong "windeployqt".

In win 10,try to find the directory where Qt is installed,like C:\Qt\Qt6.1.0\6.1.0\msvc2019_64\bin or C:\Qt\Qt6.1.0\6.1.0\mingw81_64\bin.

Your "windeployqt.exe" may be in the "msvc2019_64", "mingw81_64" or others. then use the command like C:\Qt\Qt6.1.0\6.1.0\msvc2019_64\bin\windeployqt.exe a.exe or C:\Qt\Qt6.1.0\6.1.0\mingw81_64\bin\windeployqt.exe a.exe ,instead of windeployqt.exe a.exe.

yxh
  • 21
  • 3