最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

问题:typedef name used in expression context

工作和技术 crifan 3045浏览 0评论

问题:typedef name <name> used in expression context

症状:

将一行代码(确保无语法和语义错误),放在:

#if 1

……..

#endif

之前的话,就会出现错误:

C2292E: typedef name <name> used in expression context

解决办法:

去网上找到:

http://www.arm.com/support/ADS_Errors_and_Warnings.pdf

解释说是:
This occurs when a typedef name is being used directly in an expression, e.g:
typedef int footype;
int x = footype; // reports "typedef name ‘footype’ used in expression
context"

To fix this, you must create an instance of that type (e.g. a variable of the new type) first, e.g:
typedef int footype;
footype bar = 1;
int x = bar;

但是,我这不是这个问题.

后来经过反复折腾,最后将原先那行代码移到

#if 1

……..

#endif

后面,就可以编译过了.

基本可以确定,是ARM 的编译器armcc的问题,估计是词法或语法方面分析有问题.

转载请注明:在路上 » 问题:typedef name used in expression context

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

网友最新评论 (1)

  1. 我也遇到这个问题。
    我的原因是:在定义变量之前调用了一个宏,而这个宏是可执行语句。
    把定义写到前面。
    zhinan1814年前 (2010-11-12)回复
82 queries in 0.153 seconds, using 22.11MB memory