Brian Ng
Brian Ng

Reputation: 1085

Get LNK1104 when trying to make a project using Qt5, OpenCV 2.4.9 with VC2013 compiler

Before posting this question I've already searched around many tutorials, however, all of them is outdated, or using mingw64 as the compiler.

I have add the opencv/build/x64/bin into the system path and I have no problem when working with a new project in VS2013 (with Qt5 and opencv 2.4.9 included).

Eventually, I still want to try with qt creator, since it's quite clean to package and deliever the sources of project to my partner.

I tried adding the following lines in the .pro file of my test project:

# OPENCV
OPENCV_BUILD_PATH = "D:/opencv/build"
OPENCV_INCLUDE_PATH = "$${OPENCV_BUILD_PATH}/include/"

INCLUDEPATH += "$${OPENCV_INCLUDE_PATH}"
LIBS += "$${OPENCV_BUILD_PATH}/x64/vc12/bin/*.dll"
LIBS += "$${OPENCV_BUILD_PATH}/x64/vc12/lib/*.lib"
LIBS += -lopencv_core249 -lopencv_highgui249 -lopencv_imgproc249

While linking I get this error:

error: LNK1104: cannot open file 'D:\opencv\build\x64\vc12\bin.obj'

I know that there should be some steps or some options have to be done in project settings file, but don't really know how, since mingw64 and vc12 compiler are different and I don't know much about the options of them.

It would be nice if you can help me figure out how to do this.

Thank you.

Upvotes: 0

Views: 230

Answers (2)

Brian Ng
Brian Ng

Reputation: 1085

After long time not touching this, I return back, delete every directory that Qt Creator made before, it seems running clean all and rebuild all did not do the complete clean. After that I try to run qmake and the error disappears.

Running qmake to refresh project configuration is seriously necessary, and at that time I think that qmake would be automatically run when the .pro file being edited/saved. But I was wrong, then doing it manually solved the problem.

Upvotes: 0

berak
berak

Reputation: 39806

try to change your LIBS lines. (no, you don't want to link dlls, also i doubt if wildcards are acceptable, and you're missing a -L thing for the path to the libs)

LIBS += -L"$${OPENCV_BUILD_PATH}/x64/vc12/lib
LIBS += -lopencv_core249 -lopencv_highgui249 -lopencv_imgproc249

Upvotes: 1

Related Questions