I am on Ubuntu and want to install a different version of OpenCV(2.4.13) on a custom directory. I followed this tutorial here: http://code.litomisky.com/2014/03/09/how-to-have-multiple-versions-of-the-same-library-side-by-side/
I cannot get this simple main.cpp program to compile. I cannot create a cv::Mat image, but I can obtain the OpenCV version just fine!:
#include <iostream>
#include <opencv2/core/version.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
int main(int argc, char ** argv)
{
std::cout << "OpenCV version: "
<< CV_MAJOR_VERSION << "."
<< CV_MINOR_VERSION << "."
<< CV_SUBMINOR_VERSION
<< std::endl;
cv::Mat image; //without this line, it works!
return 0;
}
Here is my makefile:
CPP = g++ -std=c++0x
# OpenCV 2.4.13
CPPFLAGS = -L/home/myname/Desktop/myfolder/rewrite/opencv-2.4.13/release/installed/lib \
-I/home/myname/Desktop/myfolder/rewrite/opencv-2.4.13/release/installed/include
all: test
test: main.cpp
$(CPP) $(CPPFLAGS) $^ -o $@
This is the compiler error:
/tmp/ccyrdd7H.o: In function `cv::Mat::~Mat()':
main.cpp:(.text._ZN2cv3MatD1Ev[cv::Mat::~Mat()]+0x39): undefined reference to `cv::fastFree(void*)'
/tmp/ccyrdd7H.o: In function `cv::Mat::release()':
main.cpp:(.text._ZN2cv3Mat7releaseEv[cv::Mat::release()]+0x47): undefined reference to `cv::Mat::deallocate()'
collect2: ld returned 1 exit status
make: *** [test] Error 1