jwm
jwm

Reputation: 5040

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?

Upvotes: 1

Views: 291

Answers (2)

jwm
jwm

Reputation: 5040

Here below is the modified .pri file that works for me!

INCLUDEPATH += c:/opencv-3.4.5/prebuild/include
CONFIG(release, debug|release):{
    LIBS += -L"c:/opencv-3.4.5/prebuild/x64/vc14/lib" -lopencv_world345
}
CONFIG(debug, debug|release):{
    LIBS += -L"c:/opencv-3.4.5/prebuild/x64/vc14/lib" -lopencv_world345d
}

The configurations by Debug:{} and Release {} do not work!

Upvotes: 0

Lambda1010
Lambda1010

Reputation: 399

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
 }

Upvotes: 1

Related Questions