I have been beating my head against this for 2 days. I built the OpenCV binaries according the the quickstart guide using CMake and MinGW. I tested the example, and 'contours.exe' works great. However when I try to compile a 'hello world' application, it cannot locate the header files.
My install is at "D:\opencv2\Builds\".
I added a system variable 'system/advanced' named OPENCV_DIR pointing to D:\opencv2\Builds\install\
My code is below:
#include <stdio.h>
#include <include/opencv2/opencv.hpp>
using namespace cv;
int main( int argc, char** argv )
{
Mat image;
image = imread( argv[1], 1 );
if( argc != 2 || !image.data )
{
printf( "No image data \n" );
return -1;
}
namedWindow( "Display Image", CV_WINDOW_AUTOSIZE );
imshow( "Display Image", image );
waitKey(0);
return 0;
I use CMake to generate a makefile and mingw32-make to compile the program.
My CMakeLists.txt reads:
cmake_minimum_required(VERSION 2.8)
project( test )
find_package( OpenCV REQUIRED )
add_executable( test test.cpp )
target_link_libraries( test ${OpenCV_LIBS} )
I get the same error code every time
"include/opencv2/opencv.hpp: No such file or directory
#include <include/opencv2/opencv.hpp>
^
How do I get the compiler to find the header files? What am I missing? Thank you so much for you help!