Ask Your Question

Revision history [back]

fatal error: No such file or directory

I was testing very first program in OpenCV. I am using OpenCV with gcc and CMake. My .cpp file is in folder "G:\OpenCV\myproj\DisplayImage.cpp"

It is as Follow:

include <stdio.h>

include <opencv2 opencv.hpp="">

using namespace cv;

int main(int argc, char** argv ) { if ( argc != 2 ) { printf("usage: DisplayImage.out <image_path>\n"); return -1; }

Mat image;
image = imread( argv[1], 1 );

if ( !image.data )
{
    printf("No image data \n");
    return -1;
}
namedWindow("Display Image", WINDOW_AUTOSIZE );
imshow("Display Image", image);

waitKey(0);

return 0;

} When I compile and run using following command:

g++ -l G:\OpenCV\opencv\sources\release\install\include -L G:\OpenCV\opencv\sources\release\lib DisplayImage.cpp -l opencv_core249 -l opencv_highgui249 -o DisplayImage.out

It gives following error: DisplayImage.cpp:2:30: fatal error: opencv2/opencv.hpp: No such file or directory

include <opencv2 opencv.hpp=""> ^

compilation terminated --Kind suggest me a solution with reason for error