Mat was intoduced in OpenCV 2 instead of IplImage*. 'cvFindContours' is part of OpenCV 1 interface, and thus it does not know what Mat is. This is the reason for your bug. You should use findContours instead. It is C++ interface of same function. See its documentation here.