Ask Your Question

DrDonut's profile - activity

2015-06-06 07:22:32 -0600 received badge  Popular Question (source)
2013-07-25 06:58:56 -0600 received badge  Editor (source)
2013-07-25 06:56:26 -0600 commented question Compiling errors in header files

Hi, Thank you so much for your answers! Including core and imgproc did the trick! Now I'm still stuck with some other problems, but if needed, I will make a separate question for those.

Thanks you and happy coding!

2013-07-24 16:01:57 -0600 received badge  Student (source)
2013-07-24 15:59:35 -0600 asked a question Compiling errors in header files

Hi all,

So I decided to try and fiddle around with openCV for a bit, but I cannot seem to get my setup working.

First I did the setup as described in the tutorials, then I tried to compile this very simple demo project:

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

using namespace cv;
using namespace std;

int main(int argc, char** argv)
{
  Mat im = 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;
}

Somehow, when I hit compile, it gives me the following errors:

17:45:49 * Incremental Build of configuration Debug for project opencvtest * Info: Internal Builder is used for build g++ "-IC:\opencv\build\include" -O0 -g3 -Wall -c -fmessage-length=0 -o "src\opencvtest.o" "..\src\opencvtest.cpp" In file included from C:/opencv/build/include/opencv2/core/core.hpp:4824, from C:/opencv/build/include/opencv2/highgui/highgui.hpp:46, from ..\src\opencvtest.cpp:1: C:/opencv/build/include/opencv2/core/operations.hpp: In static member function static cv::Ptr<_Tp2> cv::Algorithm::create(const std::string&)': C:/opencv/build/include/opencv2/core/operations.hpp:3918: error: expected primary-expression before '>' token C:/opencv/build/include/opencv2/core/operations.hpp:3918: error: expected primary-expression before ')' token C:/opencv/build/include/opencv2/core/operations.hpp: At global scope: C:/opencv/build/include/opencv2/core/operations.hpp:3970: error: got 2 template parameters forvoid cv::AlgorithmInfo::addParam(cv::Algorithm&, const char, cv::Ptr<_Tp2>&, bool, cv::Ptr<_Tp2> (cv::Algorithm::)(), void (cv::Algorithm::)(const cv::Ptr<_Tp2>&), const std::string&)' C:/opencv/build/include/opencv2/core/operations.hpp:3970: error: but 1 required C:/opencv/build/include/opencv2/core/operations.hpp:3979: error: redefinition of void cv::AlgorithmInfo::addParam(cv::Algorithm&, const char*, cv::Ptr<_Tp2>&, bool, cv::Ptr<_Tp2> (cv::Algorithm::*)(), void (cv::Algorithm::*)(const cv::Ptr<_Tp2>&), const std::string&)' C:/opencv/build/include/opencv2/core/operations.hpp:3970: error:void cv::AlgorithmInfo::addParam(cv::Algorithm&, const char, cv::Ptr<_Tp2>&, bool, cv::Ptr<_Tp2> (cv::Algorithm::)(), void (cv::Algorithm::)(const cv::Ptr<_Tp2>&), const std::string&)' previously declared here

17:45:51 Build Finished (took 1s.974ms)

As I cannot imagine that there will actually be errors in the header files, there must be something wrong with my setup. Does anyone know what I did wrong?

The setup:

  • Platform windows 7 64 bits
  • compiler: mingw
  • IDE: Eclipse with CDT
  • include path (in project settings) c:\opencv\build\include (I copied the contents from \include\opencv to \include, because otherwise the paths to the files in \include\opencv2 would not be correct).
  • library path (in project settings): c:\opencv\build\x64\mingw\lib opencv
  • version: 2.4.6
  • linked librarys: core, imgproc and highgui

Thank you all in advance!