不能将参数5从'SIZE_T *'转换为'size_t *' - 为什么? [英] cannot convert parameter 5 from 'SIZE_T *' to 'size_t *' -- why?

查看:1090
本文介绍了不能将参数5从'SIZE_T *'转换为'size_t *' - 为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在编译32位时遇到此错误。同一个文件在64位Windows上没有错误的情况下进行编译

I'm getting this error when compiling for 32-bit. The same file compiles with no errors for 64-bit Windows


1> c:\project\test.cpp(1317)错误C2664:'StringCbCopyExW':无法将参数5从'SIZE_T *'转换为'size_t *'

1>c:\project\test.cpp(1317) : error C2664: 'StringCbCopyExW' : cannot convert parameter 5 from 'SIZE_T *' to 'size_t *'

SIZE_T和size_t相同的大小和符号是什么区别?为什么我需要一个演员在这里?如果类型不同,为什么这只是在32位Windows上的错误?

Both SIZE_T and size_t have the same size and sign so what is the difference? Why do I need a cast here? And if the types are different, why is this an error only on 32-bit Windows?

推荐答案

SIZE_T std :: size_t 不同。第一个是在Windows标题中的类型 #define d,第二个是由你的C ++编译器定义的类型。

SIZE_T is different from std::size_t. The first is a type #defined in the windows headers, the second is a type defined by your C++ compiler. They are different types.

至少在我的系统上, SIZE_T typedef for ULONG_PTR ,这是 #define / code>。

At least on my system, SIZE_T is a typedef for ULONG_PTR, which is a #define for unsigned long.

这篇关于不能将参数5从'SIZE_T *'转换为'size_t *' - 为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆