Opencv and code blocks troubleshooting

I'm getting an undefined reference to cv::Mat::Mat error when i compile this program

I'm getting an undefined reference to cv::Mat::Mat error when i compile this program
I think that you are trying to code in linux. Actually the programming in linux is always a bit tricky because the dependencies are always different from the one used in windows. but if you are on windows then this will work too.
As you are getting the cv mat error, it seems that there is something wrong with the declaration type of the cv that you are using in the program.
Also the parameters that you are using must be the exact that you are passing it to. These must be the same because it is a crucial thing that must be followed every time.
you can also use the code given below inside your code and see if the error is eliminated.
v::Mat image1, image2; cv::Rect rect1, rect2; ... cv::Mat extractedImage2 = image1(rect2); image1(rect1).copyTo(extractedImage2);