Ask Your Question
1

compile time errors in openCV/C++ code.

asked 2015-03-27 12:50:21 -0600

namiqaliyev gravatar image

I have a openCV & c++ code like below.

#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>

using namespace std;
using namespace cv;

int main(int argc, const char *argv[])
{
    Mat res(720,502,CV_8UC3,Scalar(0,255,255));
    vector<int> sparam;
    sparam.push_back(CV_IMWRITE_JPEG_QUALITY);
    sparam.push_back(80);
    imwrite("/home/namiq/Pictures/IMG.JPG",res,sparam);
    namedWindow("Open Picture",CV_WINDOW_AUTOSIZE);
    imshow("Open Picture",res);
    waitKey(0);
    destroyWindow("Open Picture");
    return 0;
}

When I do g++ openpic.cpp -lopencv_core -lopencv_highgui for compile, it gives an error

/usr/bin/ld: /tmp/ccYxhFYr.o: undefined reference to symbol '_ZN2cv7imwriteERKNS_6StringERKNS_11_InputArrayERKSt6vectorIiSaIiEE'
//usr/local/lib/libopencv_imgcodecs.so.3.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

What is the problem. I am new in OPENCV, and I get many errors in c++...

edit retag flag offensive close merge delete

Comments

3

if you really are using opencv3.0, you additionally need -lopencv_imgcodecs , like your error says.

berak gravatar imageberak ( 2015-03-27 12:56:16 -0600 )edit

But it does not show the picture.....

namiqaliyev gravatar imagenamiqaliyev ( 2015-03-27 13:05:34 -0600 )edit

2 answers

Sort by ยป oldest newest most voted
2

answered 2015-07-21 20:09:26 -0600

zhoutianyou gravatar image

If you really are using opencv3.0 , you additionally need -lopencv_videoio -lopencv_imgcodecs -lopencv_video, like your error says;

edit flag offensive delete link more
-1

answered 2015-03-28 02:55:51 -0600

judu29hbc gravatar image

It doesn't show it because it is going too fast so you can see it. Just put something like 10000 in wait key function

edit flag offensive delete link more

Comments

boaz001 gravatar imageboaz001 ( 2015-03-28 17:44:53 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2015-03-27 12:50:21 -0600

Seen: 2,883 times

Last updated: Mar 28 '15