Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

cannot run compile opencv program

Hi Everyone,

I had OpenCV 2.4 on Ubuntu 12.04. My C++ codes were working fine.

Now, I installed OpenCV 2.4.9 today on the computer. My codes are now giving me errors.

For example, I run the following basic command in C++:

Mat image1 = imread(argv[1], CV_LOAD_IMAGE_GRAYSCALE);

And I get following errors:

src/main.cpp:25:37: error: ‘CV_LOAD_IMAGE_GRAYSCALE’ was not declared in this scope src/main.cpp:25:60: error: ‘imread’ was not declared in this scope

But I can create OpenCV Mat objects without any problem.

I also checked the outputs by running pkg-config opencv --libs and pkg-config opencv --cflags commands. Outputs are:

-I/usr/local/include/opencv -I/usr/local/include /usr/local/lib/lib /usr/local/lib/libopencv_core.so /usr/local/lib/libopencv_features2d.so /usr/local/lib/libopencv_flann.so /usr/local/lib/libopencv_highgui.so .......

I don't know what's going wrong. Everything was fine before.

I suspect something to do with opencv2 module, which cannot be loaded.

Please help me out.

Thanks