Eclipse CDT shows semantic errors, but compilation is ok

后端 未结 20 1443
青春惊慌失措
青春惊慌失措 2020-12-01 07:42

I have installed Eclipse Indigo for C/C++ Linux developers on Ubuntu 10.04 x86.

When I use common predefined macro __BASE_FILE__ Eclipse says Sym

20条回答
  •  佛祖请我去吃肉
    2020-12-01 08:14

    The problem occurs this way: I insert a new variable name into the code somewhere e.g. "newone" in this example:

    int a;
    
    foo()
    {
      a=17;
      newone=23;
    }
    

    The file is saved (so the indexer is reindexing). Then I added the definition:

    int a, newone;
    
    foo1()
    {
      newone=0;
    }
    
    
    foo()
    {
      a=17;
      newone=23;
    }
    

    The indexer will still shows the error at the line " newone=23;" but not at the other lines of code containing "newone".

    Solution: first define your variables, then use it.

    M.

提交回复
热议问题