andrea
andrea

Reputation: 1358

CvRect error C2661: 'CvRect::CvRect' : no overloaded function takes 4 arguments opencv

I create a:

CvRect aaaaa=CvRect(0,0,10,10);

but I got this error:

error C2661: 'CvRect::CvRect' : no overloaded function takes 4 arguments

I don't undestand why i got this since it takes 4 arguments. I'm using c++ and Opencv 2.1

Upvotes: 0

Views: 1761

Answers (2)

lyanbo
lyanbo

Reputation: 21

the error message is clear, there is no constructor function 'CvRect::CvRect' takes 4 arguments. and in fact the constructor is no arguments.

and also, it is better

CvRect aaaa; 

instead of

CvRect aaaa = CvRect();

the last one will takes one more copy constructor call.

Upvotes: 0

hmjd
hmjd

Reputation: 121961

From reading the reference guide for CvRect it seems that it is a struct with no constructor. But there is a helper method named cvRect() that can be used to create a CvRect:

CvRect aaaaa = cvRect(0, 0, 10, 10);

Upvotes: 3

Related Questions