0
votes

I've used the already compiled version of openCV for Raspberry Pi. link for anyone who is interested

After trying to compile using this command line g++ test3.cpp -o test3 -I/usr/local/include/ -lraspicam -lraspicam_cv -L/opt/vc/lib -lmmal -lmmal_core -lmmal_util -I/usr/include -lopencv_core -lopencv_highgui -lopencv_imgproc -lwiringPi -lpthread

I get the following error lines.

//usr/local/lib/libopencv_stitching.so.2.4: undefined reference to `cv::gpu::ensureSizeIsEnough(int, int, int, cv::gpu::GpuMat&)'

//usr/local/lib/libopencv_calib3d.so.2.4: undefined reference to `cv::parallel_for_(cv::Range const&, cv::ParallelLoopBody const&, double)'

//usr/local/lib/libopencv_calib3d.so.2.4: undefined reference to `typeinfo for cv::ParallelLoopBody'

//usr/local/lib/libopencv_calib3d.so.2.4: undefined reference to `cv::Mutex::unlock()'

//usr/local/lib/libopencv_calib3d.so.2.4: undefined reference to `cv::Mutex::lock()'

//usr/local/lib/libopencv_ocl.so.2.4: undefined reference to cv::TLSDataContainer::getData() const

//usr/local/lib/libopencv_features2d.so.2.4: undefined reference to cv::AlgorithmInfo::addParam(cv::Algorithm&, char const*, unsigned char&, bool, unsigned char (cv::Algorithm::)(), void (cv::Algorithm::)(unsigned char), std::basic_string, std::allocator > const&)

//usr/local/lib/libopencv_features2d.so.2.4: undefined reference to `cv::AlgorithmInfo::addParam(cv::Algorithm&, char const*, float&, bool, float (cv::Algorithm::)(), void (cv::Algorithm::)(float), std::basic_string, std::allocator > const&)'

//usr/local/lib/libopencv_features2d.so.2.4: undefined reference to `cv::AlgorithmInfo::addParam(cv::Algorithm&, char const*, short&, bool, int (cv::Algorithm::)(), void (cv::Algorithm::)(int), std::basic_string, std::allocator > const&)'

//usr/local/lib/libopencv_calib3d.so.2.4: undefined reference to `cv::Mutex::Mutex()'

//usr/local/lib/libopencv_ocl.so.2.4: undefined reference to `cv::TLSDataContainer::TLSDataContainer()'

//usr/local/lib/libopencv_calib3d.so.2.4: undefined reference to `cv::ParallelLoopBody::~ParallelLoopBody()'

//usr/local/lib/libopencv_calib3d.so.2.4: undefined reference to `cv::Mutex::~Mutex()'

//usr/local/lib/libopencv_ocl.so.2.4: undefined reference to `cv::TLSDataContainer::~TLSDataContainer()' collect2: ld returned 1 exit status

1

1 Answers

1
votes

You have not linked the executable against several libraries that are required by the program

Try using this:

g++ -lpthread `pkg-config opencv --libs` -I/usr/local/include/ -lraspicam -lraspicam_cv -L/opt/vc/lib -lmmal -lmmal_core -lmmal_util -I/usr/include -lwiringPi test3.cpp -o test3