You need to properly include the headers -I
(capital i) and libraries -l
(lowercase L).
On the newest OpenCV versions you should do:
#include <cv.h>
#include <highgui.h>
And then try to compile it with:
g++ m.cpp -o app `pkg-config --cflags --libs opencv`
Note: if you execute only pkg-config --cflags --libs opencv in the command line you will see the paths and libraries you need to include in the g++ command line.
ref: https://stackoverflow.com/questions/9094941/compiling-opencv-in-c