What's wrong with my opencv2.4.9 on ubuntu14.04LTS?
I want to install opencv2.4.9 on ubuntu14.04LTS. And I thought I did it cause I succeed in running find_obj which is an executable file opencv2.4.9 samples folder---the path is home/opencv/opencv-2.4.9/samples/c. in a terminal, cd to the path above and text ./find_obj, then a book corresponding picture shows. So I write a test.cpp to try whether opencv2.4.9 is avaliable. Test.cpp is
#include "stdio.h"
#include <iostream>
#include "opencv2/opencv.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/core/core.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 tried
g++ test.cpp
but some similar errors happened like ‘cv::Mat::create(int, int, int)’中: find_obj.cpp:(.text._ZN2cv3Mat6createEiii[_ZN2cv3Mat6createEiii]+0x8e):‘cv::Mat::create(int, int const*, int)’ undefinition quote.
And I don't think its the test.cpp 's problem cause I did g++ find_obj.cpp in a new terminal but the errors are stll there.
this is a stack overflow question. And how do you expect g++ to know what libraries you want to link to your code? check this
If you want to test faster, you can write in python instead