Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I had exactly the same issue. You don't say but you are probably using modules compiled as static libraries. The problem is about ordering of libraries, with must be given correctly in gcc compiler. In my case I was preparing this variable to feed to target_link_libaries() directive in cmake:

set(OpenCV_LIBS
    libopencv_core.a
    libopencv_imgcodecs.a
    libopencv_imgproc.a
)

Code didn't work until I changed the order of libraries to this:

set(OpenCV_LIBS
    libopencv_imgcodecs.a
    libopencv_imgproc.a
    libopencv_core.a         // <--- Put core last
)

This is needed just in gcc, msvc is free from these issues. More info about the problem here.

I had exactly the same issue. Also I have similar setup with few modules needed. You don't say but you are probably using modules compiled as static libraries. The problem is about ordering of libraries, with must be given correctly in gcc compiler. In my case I was preparing this variable to feed to target_link_libaries() directive in cmake:

set(OpenCV_LIBS
    libopencv_core.a
    libopencv_imgcodecs.a
    libopencv_imgproc.a
)

Code didn't work until I changed the order of libraries to this:

set(OpenCV_LIBS
    libopencv_imgcodecs.a
    libopencv_imgproc.a
    libopencv_core.a         // <--- Put core last
)

This is needed just in gcc, msvc is free from these issues. More info about the problem here.