How to Compile OpenCV 'Hello World'

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/

try backticks instead of single-quotes like you have

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.

Interestingly, when I omit the filename,

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

I get warnings about lame!

http://pastebin.com/dLWJaCed

(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