I almost don’t know C++, but I need help to solve project build problem. When I make project, it gives me error which says that some functions are ambigous. I clearly understand what it’s mean “It means that there are other versions of the function that take different arguments or different numbers of arguments”.But because of my few experience in C++, I don’t know how to solve it. So that’s why I’m asking for help here.
The error which I have is:
C:\opencv-build\modules\java\core.cpp:172:65: error: call of overloaded 'PCACompute(cv::Mat&, cv::Mat&, cv::Mat&, jint&)' is ambiguous
C:\opencv-build\modules\java\core.cpp:172:65: note: candidates are:
In file included from c:/opencv-git/modules/java/generator/src/cpp/converters.h:4:0,
from C:\opencv-build\modules\java\core.cpp:8:
c:/opencv-git/modules/core/include/opencv2/core/core.hpp:2383:19: note: void cv::PCACompute(cv::InputArray, cv::InputOutputArray, cv::OutputArray, int)
c:/opencv-git/modules/core/include/opencv2/core/core.hpp:2386:19: note: void cv::PCACompute(cv::InputArray, cv::InputOutputArray, cv::OutputArray, double)
C:\opencv-build\modules\java\core.cpp: In function 'void Java_org_opencv_core_Algorithm_setInt_10(JNIEnv*, jclass, jlong, jstring, jint)':
C:\opencv-build\modules\java\core.cpp:6219:32: error: call of overloaded 'set(std::string&, jint&)' is ambiguous
C:\opencv-build\modules\java\core.cpp:6219:32: note: candidates are:
In file included from c:/opencv-git/modules/java/generator/src/cpp/converters.h:4:0,
from C:\opencv-build\modules\java\core.cpp:8:
c:/opencv-git/modules/core/include/opencv2/core/core.hpp:4328:29: note: void cv::Algorithm::set(const string&, int)
c:/opencv-git/modules/core/include/opencv2/core/core.hpp:4329:32: note: void cv::Algorithm::set(const string&, double)
c:/opencv-git/modules/core/include/opencv2/core/core.hpp:4330:30: note: void cv::Algorithm::set(const string&, bool)
c:/opencv-git/modules/core/include/opencv2/core/core.hpp:4331:32: note: void cv::Algorithm::set(const string&, const string&) <near match>
c:/opencv-git/modules/core/include/opencv2/core/core.hpp:4331:32: note: no known conversion for argument 2 from 'jint {aka long int}' to 'const string& {aka const std::basic_string<char>&}'
c:/opencv-git/modules/core/include/opencv2/core/core.hpp:4332:29: note: void cv::Algorithm::set(const string&, const cv::Mat&) <near match>
c:/opencv-git/modules/core/include/opencv2/core/core.hpp:4332:29: note: no known conversion for argument 2 from 'jint {aka long int}' to 'const cv::Mat&'
c:/opencv-git/modules/core/include/opencv2/core/core.hpp:4334:35: note: void cv::Algorithm::set(const string&, const cv::Ptr<cv::Algorithm>&) <near match>
c:/opencv-git/modules/core/include/opencv2/core/core.hpp:4334:35: note: no known conversion for argument 2 from 'jint {aka long int}' to 'const cv::Ptr<cv::Algorithm>&'
If you need some more information/code, please tell and I’ll update question with it.
jintis a typedef tolong int(see'jint {aka long int}'in the lower lines).long intis a distinct type fromint(even if they have the same representation) so the compiler can’t decide between the overloads takingintanddoublein that parameter.As you appear to be on Windows,
intandlong inthave the same representation (since 64-bit Windows uses a LLP64 data model) so you can:jintto useintinstead oflong int, orlong intthat forward to theintoverload, orjintargument tointeverywhere it calls an ambiguous function