After installation I can't use OpenCV adfadsfasdfsda
Hello,
I follow this tutorial how to install openCV. After installation I tried to run this two sampels, but I get the following errors:
include <highgui.h>
int main(int argc, char ** argv) {
IplImage* img = cvLoadImage(argv[1]);
cvNameWindow("Example1", CV_WINDOW_AUTOSIZE);
cvShowImage("Example1", img);
cvWaitKey(0);
cvReleaseImage(&img);
cvDestroyWindow("Example1");
return 0;
}
e1.cpp:1:21: fatal error: highgui.h: No such file or directory
#include <highgui.h>
^
compilation terminated.
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;
}
/tmp/ccVkJxtd.o: In function `main':
ex2.cpp:(.text+0x92): undefined reference to `cv::imread(std::string const&, int)'
ex2.cpp:(.text+0x12a): undefined reference to `cv::namedWindow(std::string const&, int)'
ex2.cpp:(.text+0x15b): undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
ex2.cpp:(.text+0x19b): undefined reference to `cv::imshow(std::string const&, cv::_InputArray const&)'
ex2.cpp:(.text+0x1c3): undefined reference to `cv::waitKey(int)'
/tmp/ccVkJxtd.o: In function `cv::Mat::~Mat()':
ex2.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x39): undefined reference to `cv::fastFree(void*)'
/tmp/ccVkJxtd.o: In function `cv::Mat::operator=(cv::Mat const&)':
ex2.cpp:(.text._ZN2cv3MataSERKS0_[_ZN2cv3MataSERKS0_]+0x111): undefined reference to `cv::Mat::copySize(cv::Mat const&)'
/tmp/ccVkJxtd.o: In function `cv::Mat::release()':
ex2.cpp:(.text._ZN2cv3Mat7releaseEv[_ZN2cv3Mat7releaseEv]+0x47): undefined reference to `cv::Mat::deallocate()'
collect2: error: ld returned 1 exit status
What I did wrong?
Thanks.