Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

opengl_interop.o build error

I recently started to use OpenCV on Qt Creator 4.2.1. Now I am trying to run opengl_interop.cpp from samples/opengl but I am getting this error: opengl_interop.o: undefined reference to symbol '_ZN2cv3ogl13unmapGLBufferERNS_4UMatE'.

OS is Ubuntu 16.10.

ProjectTest.pro looks like this:

TEMPLATE = app
CONFIG += console c++11
CONFIG -= app_bundle
CONFIG -= qt

SOURCES += \
    ../../../../../../Downloads/opencv/opencv/samples/opengl/opengl_interop.cpp

INCLUDEPATH += "/usr/local/include"
LIBS += -L"/usr/lib/x86_64-linux-gnu/" -L"/usr/local/lib"
QMAKE_RPATHDIR += "/opt/Qt/5.8/gcc_64/lib"

LIBS += `pkg-config --libs opencv` -lGLU -lGL -lglut -lopencv_shape -lopencv_stitching -lopencv_objdetect -lopencv_superres -lopencv_videostab -lopencv_calib3d -lopencv_features2d -lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_video -lopencv_photo -lopencv_ml -lopencv_imgproc -lopencv_flann -lopencv_core


HEADERS += \
    ../../../../../../Downloads/opencv/opencv/samples/opengl/winapp.hpp

Compile output log

20:33:29: Running steps for project ProjectTest...
20:33:29: Configuration unchanged, skipping qmake step.
20:33:29: Starting: "/usr/bin/make" 

/opt/Qt/5.8/gcc_64/bin/qmake -o Makefile ../ProjectTest/ProjectTest.pro -spec linux-g++ CONFIG+=debug CONFIG+=qml_debug

g++ -Wl,-rpath,/opt/Qt/5.8/gcc_64/lib -o ProjectTest opengl_interop.o   -L/usr/lib/x86_64-linux-gnu/ -L/usr/local/lib `pkg-config --libs opencv` -lGLU -lGL -lglut -lopencv_shape -lopencv_stitching -lopencv_objdetect -lopencv_superres -lopencv_videostab -lopencv_calib3d -lopencv_features2d -lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_video -lopencv_photo -lopencv_ml -lopencv_imgproc -lopencv_flann -lopencv_core 
/usr/bin/ld: warning: libopencv_imgproc.so.3.2, needed by /usr/local/lib/libopencv_videoio.so, may conflict with libopencv_imgproc.so.2.4

/usr/bin/ld: warning: libopencv_core.so.3.2, needed by /usr/local/lib/libopencv_videoio.so, may conflict with libopencv_core.so.2.4

Makefile:227: recipe for target 'ProjectTest' failed

//usr/bin/ld: opengl_interop.o: undefined reference to symbol '_ZN2cv3ogl13unmapGLBufferERNS_4UMatE'
//usr/local/lib/libopencv_core.so.3.2: error adding symbols: DSO missing from command line

collect2: error: ld returned 1 exit status

make: *** [ProjectTest] Error 1

20:33:30: The process "/usr/bin/make" exited with code 2.

Error while building/deploying project ProjectTest (kit: Desktop Qt 5.8.0 GCC 64bit)

When executing step "Make"
20:33:30: Elapsed time: 00:01.