Thursday 15 September 2011

c++ - OpenCv undefined reference to `cv:: -



c++ - OpenCv undefined reference to `cv:: -

i new @ opencv. using eclipse c/c++. when seek run sample code faced these errors. should solve problem? there problem @ configurating ?

#using namespace std; #using namespace cv; int main( int argc, const char** argv ) { mat img = imread("mypic.jpg", cv_load_image_unchanged); if (img.empty()) //check whether image loaded or not { cout << "error : image cannot loaded..!!" << endl; //system("pause"); //wait key press homecoming -1; } namedwindow("mywindow", cv_window_autosize); //create window name "mywindow" imshow("mywindow", img); / waitkey(0); //wait infinite time keypress destroywindow("mywindow"); //destroy window name, "mywindow" homecoming 0; } 16:11:28 **** incremental build of configuration debug project opencv **** info: internal builder used build g++ "-ic:\\opencv\\build\\include" -o0 -g3 -wall -c -fmessage-length=0 -o "src\\opencv.o" "..\\src\\opencv.cpp" g++ "-lc:\\opencv\\build\\x86\\vc12\\lib" -o opencv.exe "src\\opencv.o" -lopencv_calib3d249 -lopencv_contrib249 -lopencv_core249 -lopencv_features2d249 -lopencv_flann249 -lopencv_gpu249 -lopencv_highgui249 -lopencv_imgproc249 -lopencv_legacy249 -lopencv_ml249 -lopencv_nonfree249 -lopencv_objdetect249 -lopencv_ocl249 -lopencv_photo249 -lopencv_stitching249 -lopencv_superres249 -lopencv_ts249 -lopencv_video249 -lopencv_videostab249 src\opencv.o: in function `main': c:\users\ayberk101\workspace\opencv\debug/../src/opencv.cpp:10: undefined reference `cv::imread(std::string const&, int)' c:\users\ayberk101\workspace\opencv\debug/../src/opencv.cpp:19: undefined reference `cv::namedwindow(std::string const&, int)' c:\users\ayberk101\workspace\opencv\debug/../src/opencv.cpp:20: undefined reference `cv::_inputarray::_inputarray(cv::mat const&)' c:\users\ayberk101\workspace\opencv\debug/../src/opencv.cpp:20: undefined reference `cv::imshow(std::string const&, cv::_inputarray const&)' c:\users\ayberk101\workspace\opencv\debug/../src/opencv.cpp:22: undefined reference `cv::waitkey(int)' c:\users\ayberk101\workspace\opencv\debug/../src/opencv.cpp:24: undefined reference `cv::destroywindow(std::string const&)' src\opencv.o: in function `zn2cv3matd1ev': c:/opencv/build/include/opencv2/core/mat.hpp:278: undefined reference `cv::fastfree(void*)' src\opencv.o: in function `zn2cv3mat7releaseev': c:/opencv/build/include/opencv2/core/mat.hpp:367: undefined reference `cv::mat::deallocate()' collect2.exe: error: ld returned 1 exit status

problem1: have include opencv / c++ header files create work:

#include "opencv2/core/core.hpp" #include "opencv2/imgproc/imgproc.hpp" #include "opencv2/highgui/highgui.hpp" #using namespace cv; #include <iostream> #using namespace std; int main() { ...

then, problem2: cannot utilize vc12 libs mingw. (it's different compiler)

there no more prebuild mingw libs opencv, so, before doing anything else, have build opencv libs locally using cmake.

again, need utilize mingw / eclipse ? (vs express still free)

c++ eclipse opencv mingw

No comments:

Post a Comment