Ask Your Question
0

Run OpenCV program

asked 2014-11-11 15:24:37 -0600

Kishore Kumar gravatar image

updated 2014-11-12 02:34:25 -0600

berak gravatar image

I am new to openCV, I am trying to compile my first code in linux ubuntu by adding following code

g++ 'pkg-config opencv --cflags' hello_opencv.cpp -o hello_opencv 'pkg-config opencv --libs'
and I got the error as 
g++: error: pkg-config opencv --cflags: No such file or directory
g++: error: pkg-config opencv --libs: No such file or directory

request you to help me solving this.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2014-11-12 02:40:19 -0600

berak gravatar image

you need backticks (`) around the pkg-config parts, not single quotes (').

the idea behind that is to run e.g. pkg-config opencv --cflags from the shell, and replace that with the outcome of it.

so, your cmdline should look like this:

g++ `pkg-config opencv --cflags` hello_opencv.cpp -o hello_opencv `pkg-config opencv --libs`

    ^- here         and  here -^
edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-11-11 15:24:37 -0600

Seen: 245 times

Last updated: Nov 12 '14