如何修复错误"long* is incompatible with U32**"?
How to fix error "long* is incompatible with U32**"?
我尝试调用具有以下签名的函数:
I32 contour8(image *a, I32 x0, I32 y0, I32 dir, I32 thr, U32 lng, U32 **dst);
使用此代码:
int posx = 100, posy = 100, dx = 300, dy = 300;
long length = 5000;
int threshold = 125;
int lx, x0 = 0, y0 = 0;
int res1 = 0, res2 = 0, *rlc, *input, i;
long dest1, dest2, desttemp, addr;
char c;
image Area;
desttemp = dest1;
res1 = contour8(&Area, x0, y0, ~2, threshold, length, &desttemp);
但是在编译时出现以下错误:
error argument of type "long *" is incompatible with parameter of type "U32 **"
导致此错误的原因是什么?
您的变量desttemp
的类型为 long
。 &desttemp
会产生您尝试作为参数dst
传递给contour8
的long*
,该参数的类型为 U32**
。
long*
不能隐式转换为U32**
,这会导致您的错误。
您应该将desttemp
设为U32*
(推荐(,或者将&desttemp
转换为U32**
(不推荐;只要您不知道自己在做什么,这就会引入其他问题(。由于我们不知道您的函数的作用/期望,因此您最终需要自己决定哪一个最适合您的情况。
在 32 位系统中,长变量的大小为 64 位。因此,您可能会在 64 个变量中传递 32 位值,从而获得错误。此外,一个简单的建议总是在声明期间初始化所有变量,你没有初始化一些变量和指针,作为一个程序员,这被认为是不好的做法。干杯。。:)
相关文章:
- Problems with std::cin.fail()
- 应用程序崩溃并显示"symbol _ZdlPvm, version Qt_5 not defined in file libQt5Core.so.5 with link time reference"
- 这对"With a stackless coroutine, only the top-level routine may be suspended."意味着什么
- Boost.TEST with CLion: "Test framework quit unexpectedly"
- 避免碎片化的ClientHellos with OpenSSL (DTLS)
- Issues with Win32 ReadProcessMemory API
- Qt with WinAPI MouseProc
- [[maybe_unused]] with structured_binding?
- 如何在 C++11 中将标准::字符串转换为标准::u32字符串?
- Issue with WriteProcessMemory
- OpenCV RTP-Stream with FFMPEG
- "Unable to start debugging. No process is associated with this object." - 在Visual Studio Code中使用GDB
- std::adjacent_difference with std::chrono time_point
- DLL Made with CMake 使程序崩溃
- QtCreator with C 库中的链接器问题
- SHBrowseForFolder with BIF_BROWSEFORCOMPUTER and SHGetPathFr
- specialized std::default_delete with QQmlComponent
- VS2019 - Sudo Remote Debugging on Linux with Cmake project
- Inference pytorch C++ with alexnet and cv::imread image
- 如何修复错误"long* is incompatible with U32**"?