Sample QT executables will not start, QT5Cored.dll is missing

QT5Cored.dll is located in my system @: C: \ Qt \ 5.4 \ mingw491_32 \ bin folder

Example Analogclock and other projects will run in the IDE, but cannot be run from the generated .exe files. When you start EXE, QT5Cored.dll error appears. QT installed it and does not know where it is? Removed and reinstalled QT with the same results. enter image description here

Stacker downloaded today. Version: 3.3.1, QT 5.4.1 (MSCV 2010, 32 bits), built February 20, 2015.

Any suggestions appreciated.

New error after adding DLLs to exe directory. enter image description here

+5
source share
1 answer

To run it outside of Qt Creator, you have two options:

  • Copy the missing DLLs into the directory where the executable is located. For example, if analogclock.exe is located in c:\examples , copy C:\Qt\5.4\mingw491_32\bin\Qt5Cored.dll and other necessary DLL files to c:\examples . You may also need to copy the plugin files.
  • Add C:\Qt\5.4\mingw491_32\bin to the PATH environment variable.

There are several ways to copy the missing DLL:

1. Use the Windows Deployment Tool (windeployqt.exe) to copy the necessary files

  • Open a command prompt in one of the following ways:
    • If you use MSVC as a compiler, open the correct Visual Studio command prompt. For example, for 32-bit VS2013, click Start -> Microsoft Visual Studio 2013 -> Visual Studio Tools -> VS2013 x86 Native Tools Command Prompt . This will open a command prompt with the correct setting of the VCINSTALLDIR variable. windeployqt.exe requires this environment variable to copy the correct Visual C ++ executable distributed.
    • If you are using MinGW, just open a command prompt.
  • Add the Qt binary path and the optional g++.exe path to the PATH environment variable. If your executable is 32-bit, add the Qt 32-bit binary path, for example: c:\Qt\5.4\msvc2013\bin . If your executable file is 64-bit, add the 64-bit Qt binary path, for example: c:\Qt\5.4\msvc2013_64\bin . windeployqt.exe will copy the DLL from this directory, so it is important that you do not set the 32-bit Qt binary path for the 64-bit executable, vice versa. You need to add the g++.exe Exe path, if you use MinGW, windeployqt will copy lib * .dll from there.

     ; Example path for MSVC 32-bit PATH=c:\Qt\5.4\msvc2013\bin;%PATH% ; Example path for MinGW 32-bit, g++.exe is in C:\Qt\Tools\mingw491_32\bin PATH=C:\Qt\5.4\mingw491_32\bin;C:\Qt\Tools\mingw491_32\bin;%PATH% 
  • Run windeployqt.exe with your executable as an argument. For instance:

     windeployqt.exe C:\Qt\Examples\Qt-5.4\widgets\richtext\build-calendar-Desktop_Qt_5_4_0_MSVC2013_32bit-Debug\debug\calendar.exe 
  • Check the output for errors or warnings. The following is the output without errors and warnings:

enter image description here

2. Manual copy of the DLL

You must copy the correct DLLs (32-bit or 64-bit). To find the correct DLL paths, use the Process Explorer tool:

  • Launch the application from Qt Creator / Visual Studio.
  • Open Process Explorer.
  • In Process Explorer
    • Click an executable file, for example calendar.exe
    • Press Ctrl+D to display the loaded DLLs in the bottom pane. Equivalent Menu View -> Lower Panel View -> DLLs
    • In the bottom pane, click the PATH column to sort by path.
  • Copy the DLLs to the directory where the executable is located. For example, in the following figure. DLL files are taken from C: \ Qt \ 5.4 \ msvc2013 \ bin.

Process explorer

  1. If your executable uses something like c:\Qt\5.4\msvc2013\plugins\platforms\qwindowsd.dll . It must also be copied. But copy from the platforms directory, not plugins . Let's say calendar.exe full path c:\examples\calendar.exe , then qwindowsd.dll should be copied to c:\examples\platforms\qwindows.dll , not c:\examples\plugins\platforms\qwindows.dll .
  2. You also need to copy the C ++ runtime library. If you are using mingw, you may need to copy libgcc_s_dw2-1.dll , libstdc++-6.dll . libwinpthread-1.dll , etc. Check Process Explorer to be sure. If you use MSVC, you need to deploy the runtime (for example: msvcp120.dll , msvcr120.dll ). At the end, your directory structure looks something like this:

     c:\examples\calendar.exe c:\examples\Qt5Cored.dll c:\examples\Qt5Widgetsd.dll c:\examples\Qt5Guid.dll c:\examples\icudt53.dll c:\examples\icuin53.dll c:\examples\icuuc53.dll c:\examples\libgcc_s_dw2-1.dll (if using mingw) c:\examples\libstdc++-6.dll (if using mingw) c:\examples\libwinpthread-1.dll (if using mingw) c:\examples\platforms\qwindowsd.dll 
+19
source

Source: https://habr.com/ru/post/1214205/


All Articles