Ask Your Question
0

opencv qt creator integration error

asked 2013-03-06 23:40:23 -0600

Capton gravatar image

updated 2013-03-09 07:03:13 -0600

Guanta gravatar image

Hello everyone, I'm totally new to opencv and have installed the version 2.4.3 on windows 7 but for weeks now i'm finding difficulties linking its libraries in qt creator.

Please i need how to do it the right way because i'm totally frustrated.


EDIT

This is the error message i get in qt creator

image description

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2013-03-07 03:28:54 -0600

Guanta gravatar image

updated 2013-03-09 07:11:11 -0600

Basically there are two ways:

  • You use the qt-way by a using *.pro file and link here against OpenCV:

    OPENCV_ROOT = c:/OpenCV2.4.3

add opencv libraries and include path ( Note: here are several libs missing, add them! )

LIBS += -lcxcore$${OPENCV_SUFFIX} -L$${OPENCV_ROOT}/lib
INCLUDEPATH += $${OPENCV_ROOT}/include
  • Or you use cmake and generate a CMakeLists.txt and add the following lines:

for QT:

find_package(Qt4 REQUIRED)
if(QT_FOUND)
include(${QT_USE_FILE})
add_definitions(${QT_DEFINITIONS})
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${QT_INCLUDE_DIR})
endif(QT_FOUND)

for OpenCV:

find_package( OpenCV REQUIRED ) 
if( OpenCV_FOUND )
list( APPEND ThirdParty_LIBS ${OpenCV_LIBS} )
    include_directories( ${OpenCV_INCLUDE_DIRS} )
endif( OpenCV_FOUND )

and finally link against them:

target_link_libraries(${PROJECT_NAME} ${QT_LIBRARIES} ${OpenCV_LIBS})

A more complete example for a CMakeLists.txt can also be found in this answer: http://answers.opencv.org/question/5786/undefined-reference-to-algorithm/


EDIT: Update

the -L says where the lib which you specify with -l is located. So that has to be set to the path where your cx*.dll is located.

edit flag offensive delete link more

Comments

I have included the path and libraries in my .pro file but i get a compiled error at where i include the libraries(Parse error[]). Please what do i do next

Capton gravatar imageCapton ( 2013-03-07 22:53:32 -0600 )edit

What exactly is your parser-error? What is your pro-file?

Guanta gravatar imageGuanta ( 2013-03-08 03:19:40 -0600 )edit
0

answered 2013-03-09 06:23:34 -0600

Capton gravatar image

This is the error message i get in qt creator

image description

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-03-06 23:40:23 -0600

Seen: 764 times

Last updated: Mar 09 '13