Errors with Qt5Core.dll



  • Hi,
    I'm trying to run first OpenCV (3.10) example with Qt (5.7) at Windows 7.

    Here is the PRO file

    QT       += core
    QT       -= gui
    TARGET = myFirstOpenCVProject
    CONFIG   += console
    CONFIG   -= app_bundle
    TEMPLATE = app
    SOURCES += main.cpp
    
    INCLUDEPATH += "E:\\opencv\\release\\include" \
                       "E:\\opencv\\release\\include\\opencv" \
                       "E:\\opencv\\release\\include\\opencv2"
    
    LIBS += -LE:\\opencv\\release\\x86\\mingw\\lib \
        -llibopencv_imgcodecs310.dll \
        -llibopencv_core310.dll \
        -llibopencv_highgui310.dll \
        -llibopencv_imgproc310.dll \
        -llibopencv_features2d310.dll \
        -llibopencv_calib3d310.dll \
    
    
    The C++ code
    
    #include <opencv2/core/core.hpp>
    #include <opencv2/highgui/highgui.hpp>
    
    int main()
    {
    	cv::Mat image= cv::imread("E:\\work\\qt\\myFirstOpenCVProject\\img.jpg");
            cv::namedWindow("My Image");
            cv::imshow("My Image", image);
            cv::waitKey(50000);
            return 1;
    }
    

    If I run it in Qt Creator, the picture is showing.
    But if I run that without QTCreator - I've error

    Entry point into procedure _Z21qRegisterResourceDataiPKhS0_S0 not find in library DLL Qt5Core.dll
    

    I was looking this forum. I find that need to copy Qt5Core.dll from C:\Qt\Qt5.7.1\5.7\mingw53_32\bin
    to my project folder. If I do that i've another error

    The procedure entry point ?left@QString@@QBE>AV1@H@Z could't be found in library DLL Qt5Core.dll
    

    Does somebody have any idea ?

    Thanks at advance

    [Code tags added ~kshegunov]



  • use the windeployqt to deploy your application it will compile QT* libs for your application .



  • Through the Qt5.7 command line, I'm typed

    windeployqt E:\work\qt\build-myFirstOpenCVProject-Desktop_Qt_5_7_1_MinGW_32bit-Release\release

    Here is the output

    E:\work\qt\build-myFirstOpenCVProject-Desktop_Qt_5_7_1_MinGW_32bit-Release\releaseE:\work\qt\build-myFirstOpenCVProject-Desktop_Qt_5_7_1_MinGW_32bit-Release\release\myFirstOpenCVProject.exe 32 bit,release executable

    E:\work\qt\build-myFirstOpenCVProject-Desktop_Qt_5_7_1_MinGW_32bit-Release\releaseE:\work\qt\build-myFirstOpenCVProject-Desktop_Qt_5_7_1_MinGW_32bit-Release\release\myFirstOpenCVProject.exe does not seem to be a Qt executable


  • Lifetime Qt Champion

    Hi,

    Technically, it's indeed not a Qt executable since there's nothing Qt in it at all. Unless you built OpenCV with Qt as highgui backend but even so, your application still doesn't use Qt.


  • Moderators

    @Vics You are using the wrong version of Qt dlls. This happens when the dll that is loaded is built by a different compiler. I.e. you have a Qt5Core.dll on your system in your system path that is built by MSVC and then you built (say using Qt Creator) a Qt5Core.dll that was built with mingw. So your app uses the mingw one but when you run it, it picks up the MSVC version.

    Since this scenario is not compatible you get that can not find entry point error.

    The windeployqt thing can fix it as it will put the correct dlls in the exe path which will be used above the system ones. Just wanted to explain in depth why this was happening so you could fix it manually (without windeploy) if you so chose.



  • Hi,

    Thank you for your reply.

    I checked my comp for Qt5Core.dll.
    The results were very intresting becouse Qt5Core.dll discovered in CMake folder. This folder was set in Path system variable.
    During installing CMake this folder was added to Path variable.

    I removed this folder from Path. Now my program working without QtCreator.

    Thanks a lot


  • Moderators

    @Vics No problem. :) Don't forget to mark this as solved for future people.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.