Why does Eclipse CDT say: 'syntax error', but compilation no problem

前端 未结 10 1432
庸人自扰
庸人自扰 2021-02-04 08:04

I am working in existing C code which has a couple of lines with statements similar to this one:

struct collect_conn *tc = (struct collect_conn *) 
     ((char *         


        
10条回答
  •  南方客
    南方客 (楼主)
    2021-02-04 08:40

    I ended up solving the problem like this. First I opened the project properties, then the C/C++ general->Paths and Symbols category. Under the Symbols tab I added this entry:

    Symbol: offsetof(TYPE,MEMBER)
    Value: ((ssize_t) &((TYPE *)0)->MEMBER)
    

    These symbols are used by the indexer but not passed to the compiler (at least in Makefile projects, I haven't tried it in the other kind of C project), so it doesn't override GCC's built-in offsetof

提交回复
热议问题