【发布时间】:2017-07-12 13:27:46
【问题描述】:
在构建我的 C++ 应用程序时,在这行代码处构建失败
if (!PyTuple_GetByte(poArgs, 0, &SourceCell.window_type))
出现这个错误
错误 C2664:“PyTuple_GetByte”:无法将参数 3 从 'char *' 到 'unsigned char *'
这是被调用的函数:
bool PyTuple_GetByte(PyObject* poArgs, int pos, unsigned char* ret);
第三个参数&SourceCell.window_type是类型char。
有没有办法像
那样在函数调用中转换/转换参数if (!PyTuple_GetByte(poArgs, 0, reinterpret_cast<unsigned char*>(&SourceCell.window_type)))
还是我必须以其他方式处理它?
【问题讨论】:
-
试试吧.....
-
A
static_cast应该可以正常工作 IIRC。 -
if (!PyTuple_GetByte(poArgs, 0, reinterpret_cast<unsigned char*>(&SourceCell.window_type)))没有用吗? -
@πάνταῥεῖ 我认为
static_cast在这里不起作用:stackoverflow.com/questions/10151834/… 因为它们是不同的类型,不是吗? -
你必须
reinterpret_cast或 c 风格的演员在这里
标签: c++ casting char unsigned-char