Trying to compile OpenCV program but returns "cannot find -lippicv" (Complete linux beginner)


So I have OpenCV 3.1.0 set up on my computer running on Ubuntu 16.04 and I'm trying to run some very simple code to try and test OpenCV and whilst it recognises the opencv #include files, I continue to have compiler errors.

Here is my C++ code:

#include <iostream>
#include <string>
#include <sstream>
using namespace std;

#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
using namespace cv;

int main(int argc, char** argv) {
    Mat color = imread("lena.jpg");
    Mat gray = imread("lena.jpg",0);

    imwrite("lenaGray.jpg", gray);

    int myRow = color.cols-1;
    int myCol = color.rows-1;

    Vec3b pixel =<Vec3b>(myRow, myCol);
    cout << "Pixel value (B,G,R): (" << (int)pixel[0] << "," << (int)pixel[1] << "," << (int)pixel[2] << ")" << endl;

    imshow("Lena BGR", color);
    imshow("Lena Gray", gray);
    return 0;

And I attempt to compile it on the Linux terminal as such:

g++ `pkg-config opencv --cflags --libs` main.cpp -o main

And this is the error that's returned:

/usr/bin/ld: cannot find -lippicv
collect2: error: ld returned 1 exit status

As the title said, I am a complete beginner at the Linux operating system whilst I am relatively competent at using the OpenCV library. I simply want to be able to use the OpenCV library and I am unable to with this error and I am very frustrated with it.

Thanks in advance for any help!

Show source
| linux   | c++   | opencv   2016-09-18 13:09 0 Answers

Answers ( 0 )

◀ Go back