I'm trying to cross compile a really simple OpenCV app for ARM platform from Ubuntu 14.04
#include <opencv2/opencv.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <stdio.h>
using namespace cv;
using namespace std;
main(int argc, char *argv[])
{
Mat img = imread("/home/linaro/Desktop/test.jpg", CV_LOAD_IMAGE_COLOR), grey_img;
if(!(img.data))
{
printf("cannot read image data");
exit(1);
}
cvtColor(img, grey_img, CV_BGR2GRAY);
imwrite("/home/linaro/Desktop/grey_test.jpg", grey_img);
}
I try to compile like this
arm-linux-gnueabi-g++ opencv_grey.cpp -o grey -I /home/me/c_projects/arm_platform/armcv_build/install/include/opencv -I /home/me/c_projects/arm_platform/armcv_build/install/include/opencv2 -L /home/me/c_projects/arm_platform/armcv_build/install/lib -lopencv_core -lopencv_imgproc -lopencv_highgui
But I get the error
/tmp/ccdN4trw.o: In function `main':
opencv_grey.cpp:(.text+0x84): undefined reference to `cv::imread(std::string const&, int)'
opencv_grey.cpp:(.text+0x168): undefined reference to `cv::imwrite(std::string const&, cv::_InputArray const&, std::vector<int, std::allocator<int> > const&)'
collect2: error: ld returned 1 exit status
These should be opencv_core which I've linked.
The includes and libraries were built and installed using CMake (from the OpenCV 3.0.0.zip), and they're definitely there, I can see them!
Help please, why is this happening?