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

问题:typedef name used in expression context

工作和技术 crifan 3509浏览

问题: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

79 queries in 0.138 seconds, using 19.19MB memory