Eclipse 3.7.0 Indigo with CDT shows many false compilation errors

前端 未结 8 1629
予麋鹿
予麋鹿 2020-12-14 18:27

I have updated my Ubuntu box to 11.10 and then Eclipse also have been updated to 3.7.0 Indigo with CDT 8.0.1

Then the following problem occurs:

相关标签:
8条回答
  • 2020-12-14 18:37

    Time after time a crash of Eclipse, the VM or the computer or even just long months of development start to wear down the stability of the workspace where Eclipse stores everything.

    Check the <workspace dir>\.metadata directory to get an idea of just how much Eclipse generates and stores in your workspace. Every time you add a plugin, upgrade a plugin, remove a plugin that puts and changes information in your workspace.

    A proof is that this issue usually comes just after upgrading Eclipse. (In my case to Indigo).

    The easiest way to fix up a dusty workspace is using the -clean command line argument to the eclipse.exe executable.

    Eclipse help docs tell us what this command does:

    if set to "true", any cached data used by the OSGi framework and eclipse runtime will be wiped clean. This will clean the caches used to store bundle dependency resolution and eclipse extension registry data. Using this option will force eclipse to reinitialize these caches.

    There are three ways one can use the -clean command line argument:

    1. Edit the eclipse.ini file located in your and add it as the first argument on the first line.
    2. Edit the shortcut you use to start Eclipse and add it as the first argument.
    3. Create a batch or shell script that calls the Eclipse executable with the -clean argument.

    The advantage of step 3 is you can keep the script around and use it each time you want to clean out the workspace.

    This page solved the problem to me!Hope it can help everybody else.

    0 讨论(0)
  • 2020-12-14 18:43

    Updated index option to active build configuration works for me,

    also I removed some files from the file list of being indexed up-front,

    0 讨论(0)
  • 2020-12-14 18:44

    Ok here is what worked for me:

    • deleted the path to the header files I created from the include path

    • compiled the project (obviously the compiler complains since it is missing user-defined headers)

    • reinserted the path to the header files I created

    • compiled the project again - worked perfectly

    I can't explain the case :(

    0 讨论(0)
  • 2020-12-14 18:48

    In the project properties, go to C/C++ Build > Tool Chain Editor, tick Display compatible toolchains only, and select Linux GCC and click Apply button.

    Now if you go to C\C++ General > Paths and Symbols, you will see new list of include paths added. If you rebuild index, the error messages should go away.

    0 讨论(0)
  • 2020-12-14 18:51

    The code analysis is causing this. It's not actually compiling the code but just doing some static checks for quick feedback. Unfortunately I don't know how to fix it, I just disabled it. Sorry I'm at work so I don't have CDT in front of me but I think it's something like:

    Window > Preferences > C++ General > Code Analysis
    

    Go there and un-check all the boxes to disable it.

    0 讨论(0)
  • 2020-12-14 18:53

    The problem is that there are a bunch of include directories that are missing from the indexer's perspective.

    Adding the following worked for me, but may depend on your particular setup where they actually exist:

    /usr/include/c++/4.6.1
    /usr/include/                
    /usr/include/c++             
    /usr/include/c++/4.6         
    /usr/include/x86_64-linux-gnu
    /usr/include/asm-generic
    /usr/include/c++/4.6.1/x86_64-linux-gnu/
    

    They can be set in Project>Properties>C++ Include Paths

    Presumably, in the future, the platform specializations for the CDT will included these automatically. I recall reading that somewhere, but cannot provide a reference.

    0 讨论(0)
提交回复
热议问题