Ask Your Question

adding opencv to my existing makefile

asked 2013-11-24 11:23:47 -0500

Aruna Vijay gravatar image

updated 2013-11-24 11:25:26 -0500

I need to add the opencv for image detection into my existing camera project, I get link error that undefined reference to `cvCreateImage'. Can you pointout what need to be done in my Makefile i just added to my exsisting Makefile ( I cant use cMake)

CFLAGS = 'pkg-config --cflags opencv' -g -O2

CPP = gcc -E

DEPS_CFLAGS = -pthread -D_GNU_SOURCE=1 -D_REENTRANT -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/libpng12 -I/usr/include/SDL -I/usr/local/include/opencv -I/usr/local/include/

DEPS_LIBS = 'pkg-config --libs opencv' -lgtk-3 -lgdk-3 -latk-1.0 -lgio-2.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo-gobject -lpango-1.0 -lcairo -lgobject-2.0 -lglib-2.0 -lSDL -lportaudio -lasound -lm -lpthread -lpng12 -lavcodec -lavutil -lv4l2 -ludev -lrt

Can you guys point out what i wrong here in the Makefile.
edit retag flag offensive close merge delete



Guess it should be `pkg-config --libs opencv` (note the ticks are different, backticks, instead of vertical ones). Also see for some examples, with them you should figure it out. Good luck!

Guanta gravatar imageGuanta ( 2013-11-24 11:34:51 -0500 )edit

It worked there was a problem because of the script.


Aruna Vijay gravatar imageAruna Vijay ( 2013-11-25 01:17:36 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2013-11-26 22:59:03 -0500

Aruna Vijay gravatar image

Problem with the script in the same make file, so with the above flag opencv get linked in the project.


edit flag offensive delete link more
Login/Signup to Answer

Question Tools


Asked: 2013-11-24 11:23:47 -0500

Seen: 751 times

Last updated: Nov 26 '13