c++ - "ld: symbol(s) not found for architecture x86_64" for OpenCV 3 -
i have installed opencv 3 using cmake on mac yosemite. using eclipse ide , while building solution showing error:
g++ -l/usr/local/lib -o "test1" ./main.o -lopencv_imgcodecs -lopencv_highgui -lopencv_core undefined symbols architecture x86_64: "cv::videocapture::read(cv::_outputarray const&)", referenced from: _main in main.o "cv::videocapture::videocapture(int)", referenced from: _main in main.o "cv::videocapture::~videocapture()", referenced from: _main in main.o "cv::videocapture::get(int) const", referenced from: _main in main.o "cv::videocapture::isopened() const", referenced from: _main in main.o ld: symbol(s) not found architecture x86_64 clang: error: linker command failed exit code 1 (use -v see invocation) make: *** [test1] error 1
i have added header files , libraries in settings. please me rid of error. in advance
code:
#include "opencv2/highgui/highgui.hpp" #include <iostream> using namespace cv; using namespace std; int main(int argc, char* argv[]) { videocapture cap(0); // open video camera no. 0 if (!cap.isopened()) // if not success, exit program { cout << "cannot open video cam" << endl; return -1; } double dwidth = cap.get(cv_cap_prop_frame_width); //get width of frames of video double dheight = cap.get(cv_cap_prop_frame_height); //get height of frames of video cout << "frame size : " << dwidth << " x " << dheight << endl; namedwindow("myvideo",cv_window_autosize); //create window called "myvideo" while (1) { mat frame; bool bsuccess = cap.read(frame); // read new frame video if (!bsuccess) //if not success, break loop { cout << "cannot read frame video stream" << endl; break; } imshow("myvideo", frame); //show frame in "myvideo" window if (waitkey(30) == 27) //wait 'esc' key press 30ms. if 'esc' key pressed, break loop { cout << "esc key pressed user" << endl; break; } } return 0; }
Comments
Post a Comment