Search code examples
qtopencvqmake

Qt5 OpenCV3.4.5 LNK1105 cannot open opencv_world345d.obj


I am building a Qt5 project with OpenCV3.4.5 in windows. The OpenCV is a prebuilt version with opencv_world345.lib and opencv_world345dlib. I create a .pri file for including opencv into the Qt project. Here below is for the opencv .pri file:

INCLUDEPATH += C:/opencv-3.4.5/prebuild/include \
               C:/opencv-3.4.5/prebuild/include/opencv \
               C:/opencv-3.4.5/prebuild/include/opencv2
Debug: {
LIBS += lc:/opencv-3.4.5/prebuild/x64/vc14/lib/opencv_world345d
}
Release: {
LIBS += lc:/opencv-3.4.5/prebuild/x64/vc14/lib/opencv_world345
}

I also set C:\opencv-3.4.5\prebuild\x64\vc14\bin in the path of systems variables.

Building the project in debug mode gives the error: LINK : fatal error LNK1104: cannot open file 'lc:\opencv-3.4.5\prebuild\x64\vc14\lib\opencv_world345d.obj'.

What causes the error? Do I miss something else in configuring opencv for Qt?


Solution

  • Have you run qmake since making your changes to the .pri file?

    Normally I would have asked for clarification in the comments, but I'm new to Stack Overflow and don't have 50 reputation yet.

    EDIT:

    I found an old project of mine that I have OpenCV3.1.0 properly linked to. Here's what I have in my .pro

    LIBS += -L*PATH TO OPEN CV*/OpenCV-3.1.0/lib
    
    
    INCLUDEPATH += *PATH TO OPEN CV*/OpenCV-3.1.0/include
    CONFIG(release, debug|release):{
        LIBS += \
            -lopencv_world310
    }
    
    CONFIG(debug, debug|release):{
        LIBS += \
            -lopencv_world310d
     }