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

【已解决】Ubuntu下Eclipse中交叉编译C项目出错:Symbol ‘off’ could not be resolved

Eclipse crifan 3412浏览 0评论

【问题】

折腾:

【记录】Ubuntu下使用Eclipse编译项目

期间,虽然之前已经解决了很多error:

【已解决】Eclipse通过Makefile调用交叉编译器交叉编译C项目出错:Type ‘FILE’ could not be resolved

【已解决】Eclipse中交叉编译C项目出错:Symbol ‘SETVAL’ could not be resolved

【已解决】Ubuntu下Eclipse中交叉编译C项目出错:Symbol ‘NULL’ could not be resolved

但是,还是无法消除此错误:

Description    Resource    Path    Location    Type
Symbol ‘off’ could not be resolved    wbmConfWhartNet.c    /HART-IP/WBM/Src    line 746    Semantic Error

last error symbol off could not be resolved

【解决过程】

1.后来发现,和off对应的on,是可以找到的:

on enum is ok

2.然后看到原始的on的定义,是个enum:

enum { on, off, pending
};

found enum for off

3.所以,很明显是:

on,off,都是enum枚举值。

on识别出来了,但是off没有识别出来。

4.参考:

Eclipse CDT C++ enum “could not be resolved”

去重建索引:

index freshen all files

结果还是不行。

5.关闭了打开的文件,刷新一下,也还是不行。

6.再去试试:

re-solve unresolved includes

re-solve unresolved includes

也还是没用。

7.再去试试那个update with modified files,也还是没用。

8.目前说法是,这的确是一个bug:

Bug 356057 – typedef enum removed from index after changes in header file

9.试试,把:

enum { on, off, pending
};

改为:

enum {
	on,
	off,
	pending
};

看看是否有效果。

结果错误依旧。

10.突然发现,其实,对于此处的enum:on,off,pending来说,on和pending都是可以识别的:

on pending both can resolve

就是off无法识别。

所以,猜测,会不会由于,在别处,哪里也有off的定义,导致冲突了??

但是没有发现。

11.然后重启了一下Eclipse,重新clean后,再build,然后就消除此错误了。。

12.最后,再完整的确认一下:

先去clean:

make target build for clean

然后选择clean:

choose clean build

对应的console可以看到结果:

console show clean result

然后再去build all:

choose all then build

输出结果是:

all build result

对应的,此处没了那个off的错误:

no off error - 1

no off error - 2

 

【总结】

此处,最终还是:

通过重新Eclipse,重新刷新,重新clean和编译,而解决了此问题

-> 说明了,Eclipse中,报错的话,千万不要轻易相信,因为实际上很可能是Eclipse本身的bug,而不是程序本身的bug。

尤其是当程序可以正常编译,可以生成我们要的文件时,对于报错,可以暂时忽略不理会。

转载请注明:在路上 » 【已解决】Ubuntu下Eclipse中交叉编译C项目出错:Symbol ‘off’ could not be resolved

发表我的评论
取消评论

表情

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

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
82 queries in 0.168 seconds, using 22.26MB memory