Undefined reference to documented function (Bug #3756)


Added by Mikulas Krupicka over 10 years ago. Updated over 10 years ago.


Status:Done Start date:2014-06-17
Priority:Normal Due date:
Assignee:Vadim Pisarevsky % Done:

0%

Category:core
Target version:-
Affected version:2.4.9 (latest release) Operating System:Linux
Difficulty:Easy HW Platform:x64
Pull request:

Description

I want to use "Mat::zeros(int ndims, const int* sz, int type)" function. But when I try to compile, I get an undefined reference error.

Minimal working example:

#include <opencv2/opencv.hpp>
int main() {
int dims[] = {4,2,8,5};
cv::Mat m = cv::Mat::zeros(4, dims, CV_16SC1);
return 0;
}

Which results in:

CMakeFiles/test.dir/main.cpp.o: In function `main':
main.cpp:(.text+0x50): undefined reference to `cv::Mat::zeros(int, int const*, int)'
collect2: error: ld returned 1 exit status
make[2]: *** [test] Error 1
make[1]: *** [CMakeFiles/test.dir/all] Error 2
make: *** [all] Error 2

I believe it should work according to the documentation:
http://docs.opencv.org/modules/core/doc/basic_structures.html#static%20MatExpr%20Mat::zeros(int%20ndims,%20const%20int*%20sz,%20int%20type)


Associated revisions

Revision 7b160fa3
Added by be rak over 10 years ago

added missing impl for multi-dim Mat::ones, Mat::zeros (issue #3756)

Revision 0172bd6b
Added by Vadim Pisarevsky about 10 years ago

Merge pull request #3756 from eliteraspberries:cast-double

History

Updated by be rak over 10 years ago

yes, the code seems to be missing in 2.4.9 (same for ones & eye)

[3.0 has it, though](https://github.com/Itseez/opencv/blob/master/modules/core/src/matop.cpp#L1635)

Updated by Steven Puttemans over 10 years ago

This has been fixed. 2.4.9 has this now.

  • Status changed from New to Done

Also available in: Atom PDF