-1

I'm new here and I've been trying to set up OpenCV on my codeblocks IDE. I'm not sure whats wrong. I'm using windows 7, 64bit system, and codeblocks, I also downloaded 2-4.3 version of OpenCV.

I tried following the manual intsructions here, but that was of no help: http://opencv.willowgarage.com/wiki/CodeBlocks

Even though I'm trying to use codeblocks I also tried: Installing OpenCV 2.4.3 in Visual C++ 2010 Express

I have my path set to: C:\OpenCV\build\x64\vc10\bin

And for the compiler settings under tab "search directories": "Compiler" : C:\OpenCV\build\include "Linker" : C:\OpenCV\build\x64\vc10\lib

And then under the tab "Linker settings" I have all the .lib files from C:\OpenCV\build\x64\vc10\lib

I tried running this as my test program and it gives me an error readout connecting to operations.hpp header file:

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

using namespace cv;
using namespace std;

int main()
{
   Mat im = imread("c:/full/path/to/lena.jpg");
   if (im.empty())
   {
       cout << "Cannot load image!" << endl;
       return -1;
   }
   imshow("Image", im);
   waitKey(0);
}

The error says:

C:\OpenCV\build\include\opencv2\core\operations.hpp|3915|error: expected primary-expression before '>' token|
C:\OpenCV\build\include\opencv2\core\operations.hpp|3915|error: expected primary-expression before ')' token|

....and a bunch of other stuff, but those are the first 2 errors.

So my 2 fold question is this:
1) Did I set up my IDE correctly?
2) Is there something wrong with the OpenCV code?

Community
  • 1
  • 1
xzerobit
  • 11
  • 2
  • you should #include stl files (such as iostream with the <> parentheses instead of "". This probably has nothing to do with your problem but it's more than just good practice – eladidan Feb 14 '13 at 23:55
  • also, what compiler are you using in CodeBlocks? It seems that you are linking against the msvc10. Are you compiling with msvc10 from CodeBlocks? Otherwise, you should link against libs for the appropriate compiler. – eladidan Feb 15 '13 at 00:00
  • why don't you start by compiling a hello world? It seems you wouldn't be able to compile that either. – carlosdc Feb 15 '13 at 01:12
  • Apparently the default compiler is GNU GCC. Do I have to use the mingw library and bin then? – xzerobit Feb 15 '13 at 03:31
  • Yeah I tried changing the libraries and bin to mingw....I still get the same error. – xzerobit Feb 15 '13 at 04:07
  • have you tried setting your compiler options to --std=c++11 (right click on project and build options) ??? – user1398593 Jul 27 '17 at 16:06

2 Answers2

0

The solution of this problem is to edit the line 3915 of operations.cpp file. The correct return argument is

return _create(name).Ptr<_Tp>();

0

have you tried include opencv core?

#include "opencv2/core/core.hpp"

my assumption is you don't use the core function, so your code not recognize some function.

Robert
  • 5,278
  • 43
  • 65
  • 115
edpr
  • 1
  • 1