gpt4 book ai didi

C++:模糊函数

转载 作者:太空宇宙 更新时间:2023-11-04 15:48:22 26 4
gpt4 key购买 nike

我几乎不懂 C++,但我需要帮助来解决项目构建问题。当我制作项目时,它给我错误,提示某些功能不明确。我很清楚这是什么意思"It means that there are other versions of the function that take different arguments or different numbers of arguments" .但是由于我对C++的经验不多,不知道怎么解决。这就是我在这里寻求帮助的原因。

我遇到的错误是:

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>&'

如果您需要更多信息/代码,请告诉我,我会用它更新问题。

最佳答案

jintlong int 的类型定义(请参阅下面几行中的 'jint {aka long int}')。 long int 是不同于 int 的类型(即使它们具有相同的表示形式)因此编译器无法在采用 int 的重载之间做出决定和该参数中的 double

正如您在 Windows 上看到的那样,intlong int 具有相同的表示形式(因为 64 位 Windows 使用 LLP64 data model )因此您可以:

  • 将包含 jint 定义的项目配置为使用 int 而不是 long int,或者
  • 添加采用 long int 转发到 int 重载的重载,或者
  • jint 参数转换为 int 调用模糊函数的地方

关于C++:模糊函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12859710/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com