Question

This one is tough ! Please don't mistake this for a newbie question ;) I have far too many miles in this OpenCV + MinGW static stuff for the simple mistakes....

Environment: a. Qt 5.0.1 built with MinGW (the standard opensource download from qt-project) - so everything is built with the same MinGW environment. b. Using CMake I setup minimal build (using the same g++/gcc as Qt) and turned OFF SHARED_LIBRARIES. c. generated the cmake + mingw32-make + mingw32-make install works fine.

up till here everything looks pretty smooth ...

Now when I added:

win32-g++:INCLUDEPATH += D:/Dev/opencv/build/install/include
win32-g++:LIBS += -LD:/Dev/opencv/build/install/lib
win32-g++:LIBS += -static
win32-g++:LIBS += -llibopencv_core243d
win32-g++:LIBS += -llibopencv_imgproc243d
win32-g++:LIBS += -llibopencv_highgui243d

(and also without the "win32-g++" addition..)

I get d:/dev/qt/qt5.0.1/tools/mingw/bin/../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -llibopencv_highgui243d

...
...

now.. I do have libopencv_highgui243d.a in the right directory, but the ld.exe linker is ignoring anything else than a lib ! which supposed to be a MS library (which I wanted to avoid in the first place!!!) - I even tried to rename the .a files to .lib which caused the linker to regard the files, but show many "unreferenced" errors...

So who's to blame? the linker? CMake? mingw? Qt? ....

I tried many command line / flag options but without success ..

Était-ce utile?

La solution

You should be referring to the libraries as:

LIBS += -lopencv_core243d
LIBS += -lopencv_imgproc243d
LIBS += -lopencv_highgui243d

Since -l already inserts lib at the beginning of the name.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top