0

I tried integrating QT and OpenCV with the following .pro but I still get errors about linking.

######################################################################
# Automatically generated by qmake (2.01a) Wed Apr 6 17:34:22 2011
######################################################################

TEMPLATE = app
TARGET = 
DEPENDPATH += .
INCLUDEPATH += .
QT+=opengl
# Input
HEADERS += glwidget.h mainwindow.h ui_info.h ui_information.h
FORMS += mainwindow.ui
SOURCES += glwidget.cpp main.cpp mainwindow.cpp
RESOURCES += res.qrc

INCLUDEPATH += /usr/local/include/opencv 
LIBS += /Library/Frameworks/OpenCV/lib

any idea what I can do?

1
  • 1
    Can you post the errors? Commented Apr 9, 2011 at 18:24

4 Answers 4

1

you are missing library name in this configuration, specify the libs names as following:

LIBS += -L/usr/local/lib -lcv -lhighgui

Library names can change with versions of OpenCV, so you have to look at OpenCV documentation. A simpler method will be to use pkg-config by replacing INCLUDEPATH and LIBS with the following in your project .pro file:

CONFIG += link_pkgconfig
PKGCONFIG += opencv
Sign up to request clarification or add additional context in comments.

Comments

1

I Finally found a solution. I Have moved my blog I will post again soon. If you need it just msg me and I will send to you!

Comments

0

try to add the filename of the lib to the path. LIBS += /Library/Frameworks/OpenCV/lib/opencv.lib

1 Comment

you mean add each of the lib files? e.g. libopencv_highgui.2.2.0.dylib.
0

The EASIEST and most SURE way to link an external library like OpenCV is to use the "Add Library" wizard inside Qt Creator.

The steps listed below are found in the Qt5 documentation: [http://doc.qt.io/qtcreator/creator-project-qmake-libraries.html][1] under the "To Add Library" section.

  1. Right click on the project file located in the 'project pane' on the left side of the creator... and select "Add Library..."
  2. Follow the instructions of the wizard

Let me add some specificity from here...

  1. Select "External Library"
  2. For the "Library File" navigate to your opencv_worldXXX.lib file (or opencv_worldXXXd.lib file, you will notice that by specifying only one or the other the wizard has a checkbox which includes the other automatically) [ex. ...\opencv\build\x64\vc12\lib\opncv_world.lib]
  3. For the "Include Folder" navigate to the "include" folder within the build. [ex. ...\opencv\build\include]
  4. Select your operating system, dynamic/static library (whichever is appropriate)
  5. Hit NEXT, CLEAN UP, and RUN!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.