简体   繁体   English

错误C2227:“-> yr”的左侧必须指向类/结构/联合/泛型类型

[英]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.

相关问题 C ++错误1错误C2227:“-> keyPress”的左侧必须指向类/结构/联合/泛型类型 - C++ Error 1 error C2227: left of '->keyPress' must point to class/struct/union/generic type C ++错误C2227:“-> looseHealth”的左侧必须指向类/结构/联合/泛型类型 - C++ error C2227: left of '->looseHealth' must point to class/struct/union/generic type C2227:' - > send'的左边必须指向class / struct / union / generic类型 - C2227: left of '->send' must point to class/struct/union/generic type 错误C ++ Visual Studio C2227'-> Init'的左边必须指向类/结构/联合/泛型类型 - error c++ visual studio c2227 Left of '->Init' must point to class/struct/union/generic type 错误C2227:“->”“函数名称”模板类错误的左侧 - error C2227: left of '->' “function name” template class error 错误C2227,C2065,类别中的类别 - Error C2227,C2065, Class within a Class C ++类查询错误:“”的左侧必须指向类/结构/联合 - C++ classes query error : left of “” must point to class/struct/union 错误:C2228:“”的左侧必须具有class / struct / union - Error: C2228: left of '' must have class/struct/union 错误C2027和错误C2227 - error C2027 and error C2227 为什么此代码会生成编译器错误C2227? - Why does this code generate the compiler error C2227?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM