[SOLVED]Raspbian Build error with opencv [closed]

asked 2020-01-15 04:00:54 -0500

ssdroon30 gravatar image

updated 2020-01-17 08:58:45 -0500

supra56 gravatar image

Hello everybody!

I have a Raspberry PI 3B with installed Rasbian OS on SD card. I installed Opencv 4.2.0 on my device, but when I would like to Build an example I become some errors:

displayimage.cpp:(.text+0x3c): undefined reference to `cv::imread(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
/usr/bin/ld: displayimage.cpp:(.text+0x9c): undefined reference to `cv::imshow(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cv::_InputArray const&)'
/usr/bin/ld: displayimage.cpp:(.text+0xc8): undefined reference to `cv::waitKey(int)'

... My C++ code is very simple:

#include <iostream>
#include "opencv2/opencv.hpp"

using namespace cv;
using namespace std;

int main(){
        Mat img=imread("car.jpeg");
        imshow("Car image", img);
        return 0;

I checked the include files, and I made an simbolic link for opencv include files, so the compiler can see the header files. I checked also the lib, and bin files, I see everything is ok. I dont know what schould I do now. I dont have any idea. Can you help my?


2020.01.15. 13:07 Now I can with CMAKE file compile the example code. I think I must configure Geany, and the QTCreator to using OpenCV librarys.

2020.01.17. Everything is ok! I can use now all my opencv examples.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by berak
close date 2020-01-15 06:14:47.244763


please show, how you compile / link it.

( seems you're not linking any opencv libs )

berak gravatar imageberak ( 2020-01-15 04:31:11 -0500 )edit