Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

compile time errors in openCV/C++ code.

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;
    namedWindow("Open Picture",CV_WINDOW_AUTOSIZE);
    imshow("Open Picture",res);
    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/ 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++...