问题
I am making a project in Qt 5.6.1. When I run it inside Qt Creator, it runs perfectly. But when I run it inside the folder, it shows:
The procedure entry point ??0QVariant@@QAE@ABVQString@@@Z could not be located in the dll Qt5Core.dll.
How can I fix it?
回答1:
If you have multiple versions of Qt installed everything might work well inside QtCreator where the Kits are set properly. When you run from the build directory directly it might happen that you have another version of Qt in paths which is used during execution.
If this is the case go to Control Panel > System > Advanced system settings > Advanced tab > Environment Variables
. There you should update Path
variable. In front of it put the path to where your Qt dlls can be found. For example: C:\Qt\Qt5.6.1\5.6\mingw492_32\bin
If this is only a one time thing for you, instead you can just copy the needed dll or dlls to where your executable is. The result should be the same.
EDIT:
To assure the same dlls are loaded when you run from outside of the Qt Creator you can use Dependency Walker. Run the tool and open the exe you want to start. Then in the left pane find and select QT5CORE.DLL
and hit alt+enter to show properties. Verify that the specified location points actually to C:\Qt\Qt5.6.1\5.6\mingw49_32\bin
which is where you have your Qt installed.
If it's correct you can double check that Qt Creator uses the same directories during execution. To do this, open your project go to Projects tab and in the Build Environment section show details and check whether QTDIR variable points to the same directory as found with Dependency Walker.
来源:https://stackoverflow.com/questions/40744629/qt-error-procedure-entry-not-found