[英]error C2227: left of '->yr' must point to class/struct/union/generic type
I'm writing encrypt/decrypt program for WinCE. 我正在为WinCE编写加密/解密程序。
When I compile the program i get errors like: error C2227: left of '->yr' must point to class/struct/union/generic type 当我编译程序时,出现如下错误: 错误C2227:'-> yr'的左侧必须指向类/结构/联合/泛型类型
The snippet for this is: 此代码段是:
void ai(struct AES_ctx* ctx, const uint8_t* key)
{
k(ctx->yr, key);
}
and the corresponding header snippet: 和相应的标头代码段:
#define AES_BLOCKLEN 16
#define AES_KEYLEN 32
#define AES_keyExpSize 240
struct AES_ctx
{
uint8_t yr[AES_keyExpSize];
uint8_t Iv[AES_BLOCKLEN];
};
void ai(struct AES_ctx* ctx, const uint8_t* key);
With StandardSDK_500 ARMv4I compiler works fine, but with MIPSII I got this. 使用StandardSDK_500,ARMv4I编译器可以正常工作,但是使用MIPSII,我可以做到这一点。
Can anybody help to resolve this error? 有人可以帮助解决此错误吗?
There is nothing wrong with your code: it compiles fine. 您的代码没有错:可以编译。
(if ctx
is a macro, defined in some #included
header file, all sorts of errors could be produced by this code, including the one you report, and this could be compiler dependent; test with #ifdef ctx ...
) (如果
ctx
是宏,在某些#included
头文件中定义,则该代码可能会产生各种错误,包括您报告的错误,并且可能与编译器有关;请使用#ifdef ctx ...
测试)
You may want to run the pre-processor (typically with the option -E
) and look at the code produced. 您可能需要运行预处理器(通常使用
-E
选项),并查看生成的代码。
(As a side remark, in C++ this looks more like (作为补充,在C ++中,这看起来更像
namespace AES {
constexpr int blocklen=16;
constexpr int keylen=32;
constexpr int keyExpSize=240;
struct ctx {
std::uint8_t yr[keyExpSize];
std::uint8_t Iv[blocklen];
};
// etc
}
ie no macros, no pollution of global namespace.) 即没有宏,不会污染全局名称空间。)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.