How to Compile OpenCV 'Hello World'

188 views
Skip to first unread message

Ben Nguyen

unread,
Jul 11, 2016, 11:32:10 PM7/11/16
to BeagleBoard

I understand opencv is installed on the stock debian 8.4 distro included with the beaglebone black

i.e. pkg-config --modversion opencv returns 2.4.9.1


However, when I try to compile a simple hello-world test file:

g++ -O2 'pkg-config --cflags --libs opencv' test.cpp -o test


I get an error that there is no such file or directory for opencv,

g++: error: pkg-config --cflags --libs opencv: No such file or directory


I'm running as root, but is there someother setup (path, folder permissions) that need to be done first?   


I'm following the tutorial/code directly from here:
http://derekmolloy.ie/beaglebone/beaglebone-video-capture-and-image-processing-on-embedded-linux-using-opencv/

Jerry Davis

unread,
Jul 12, 2016, 12:19:03 AM7/12/16
to beagleboard

On Mon, Jul 11, 2016 at 8:32 PM, Ben Nguyen <parkerl...@gmail.com> wrote:
'pkg-config --cflags --libs opencv'


try backticks instead of single-quotes like you have


--
Extra Ham Operator: K7AZJ
Registered Linux User: 275424
Raspberry Pi and Arduino developer

The most exciting phrase to hear in science - the one that heralds new discoveries - is not "Eureka!" but "That's funny...".
- Isaac. Asimov

Wally Bkg

unread,
Jul 12, 2016, 3:51:40 PM7/12/16
to BeagleBoard
And if that doesn't work, make sure the development packages ( libxxx-dev) for the open CV libraries are also installed.  Its one of my biggest frustrations with Debian/Ubuntu that  installing the library doesn't generally install the header files for that library.

Ben Nguyen

unread,
Jul 14, 2016, 10:31:07 PM7/14/16
to BeagleBoard
Interestingly, when I omit the filename,

g++ -O2 `pkg-config --cflags --libs opencv` 

I get warnings about lame! 
(ex. libmp3lame.so.0 needed by //usr/lib/arm-linux-gnueabihf/libavcodec.so not found )

Why would it be looking for lame/mp3 files to compile?   lame installed without errors (3.99.5),  so it must be something else right?
Ben
Reply all
Reply to author
Forward
0 new messages