Eclipse CDT shows semantic errors, but compilation is ok

后端 未结 20 1392
青春惊慌失措
青春惊慌失措 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:05

    This is a file indexing issue.

    Solution - Right click on the project, Index->Freshen all files.

    (Applies to Eclipse CDT.Oxygen)

    0 讨论(0)
  • 2020-12-01 08:06

    Updated: You have to add proper paths to Project->Propoerties->C/C++ General->Paths and Symbols. If it does not help, you can configure Eclipse Code Analyser (which generates the 'errors') in Project->Properties->C/C++ General->Code Analysis. Under the error description you have problem with, try Customize Selected->Scope->Exclusion Patterns.

    0 讨论(0)
  • 2020-12-01 08:07

    I think it has something to do with the workspace/.metadata. I had the problem of semantic errors reported but Hello World compiles and runs. I deleted the project, created another one, same error reporting. Reinstalled CDT, same thing. Deleted the workspace, shut down Eclipse, restarted, created new hello world, same thing. Deleted the workspace again, shut down Eclipse again, this time noticed that Eclipse had recreated the workspace folder during shutdown when it couldn't find it. Deleted the workspace with Eclipse shut down. Restarted Eclipse, created HW project, errors show for about a second and then gone. Deleted project, created another one, errors show for a sec, then poof. If you actually had projects in your workspace (mine was a clean install), I bet that you could just delete the .metadata folder within the workspace, and it would fix it.

    0 讨论(0)
  • 2020-12-01 08:08

    If on Ubuntu, go to Window > Preferences > In Search box type "Indexer" > Select Indexer in left column. Under heading "Indexer Options" tick the following options (all but those involving the skipping of files):

    • Index files source files not included in project
    • Index unused Headers Index all header variants
    • Index source and header files openend in editor
    • Allow heuristic resolution of includes

    Under heading "Indexing Strategy" tick both options which are:

    • Automatically update the index
    • Update index immediately after every file-save

    Under heading "Build Configuration for the indexer" select the following option:

    • User active build configuration
    0 讨论(0)
  • 2020-12-01 08:09

    Not sure if this addresses your specific problem, but I also had semantic errors. They just came out of the blue after having a working project.

    Anyway, I fixed it with a single option in workspace settings by setting: "Build configuration for indexer: Use active build configuration"

    The other option was "Use the build configuration specified in the project's indexer settings" and this is the one that wasn't working. I think it may have been corrupted after an eclipse crash.

    0 讨论(0)
  • 2020-12-01 08:10

    In the past, I would define the ANDROID symbol in: Project -> Properties->C/C++ General -> Paths and Symbols -> #Symbols tab However, the latest version of Eclipse no longer has a # Symbols there, or anywhere else. It seems there is no longer any way of defining symbols in Eclipse. Eclipse has so many bugs and problems. I finally gave up and switched to using Gedit and the terminal to compile.

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