user2529307
user2529307

Reputation: 25

Opencv --- I cannot use the function imread

I have a problem in opencv function. I can use

IplImage* img = CvLoadImage("2_DeepViewOutput.png");

However I cannot use

Mat img = imread("2_DeepViewOutput.png");

It gave me

Multiple markers at this line - Line breakpoint: Hello.cpp [line: 11] - undefined reference to `cv::imread(std::string const&, int)'

I think I have loaded the library in the path. I did not know the reason, please help me.

Upvotes: 1

Views: 3186

Answers (2)

SRF
SRF

Reputation: 979

The problem is that you have included C header files, not C++ header files. So, your program cannot be compiled because the declaration of the cv::imread(std::string const&, int) function is not present in the C header file.

So, you have to include C++ header files. (e.g - #include "opencv2/highgui/highgui.hpp") (This link will help you)

And if you have not configured your IDE for C++, please go through this link

Upvotes: 1

user2727765
user2727765

Reputation: 616

The problem is with the missing dll in your IDE path. Following this link step by step will solve your issue.

Upvotes: 0

Related Questions