Error inbuilding opencv2.4.9 project in Eclipse using Mingw on Windows7 32bit

asked 2015-01-04 22:57:26 -0500

Govind Mali gravatar image

updated 2015-01-05 00:56:29 -0500

Program Code:

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

using namespace cv;
using namespace std;

int main(int argc, char** argv)
{
  Mat im = cv::imread(argc == 2 ? argv[1] : "lena.jpg", 1);
  if (im.empty())
  {
     cout << "Cannot open image!" << endl;
     return -1;
  }

  imshow("image", im);
  waitKey(0);

  return 0;
}

and Error is: 10:13:00 * Incremental Build of configuration Debug for project Radhe * Info: Internal Builder is used for build g++ "-IC:\opencv\build\include\opencv" "-IC:\opencv\build\include" -O0 -g3 -Wall -c -fmessage-length=0 -o Krishna.o "..\Krishna.cpp" g++ "-LC:\opencv\build\x86\vc10\lib" -o Radhe.exe Krishna.o -lopencv_core249 -lopencv_highgui249 -lopencv_imgproc249 Krishna.o: In function main': C:\Govind\Radhe\Radhe\Debug/../Krishna.cpp:9: undefined reference tocv::imread(std::string const&, int)' C:\Govind\Radhe\Radhe\Debug/../Krishna.cpp:16: undefined reference to cv::_InputArray::_InputArray(cv::Mat const&)' C:\Govind\Radhe\Radhe\Debug/../Krishna.cpp:16: undefined reference tocv::imshow(std::string const&, cv::_InputArray const&)'

edit retag flag offensive close merge delete

Comments

you're trying to link against the prebuild VS2010 libs. - that won't work. you will have to build the opencv libs from src, before you can use them with mingw.

berak gravatar imageberak ( 2015-01-05 02:53:16 -0500 )edit