Why does Eclipse put pseudo errors in my source?

I locally searched (via hg clone ) a C / C ++ project (Eclipse CDT) and imported it into the Eclipse workspace. The editor window for a forked project now looks like this:

enter image description here

Clearly, these are not real mistakes, as the code builds correctly. In addition, these errors were not noted in the original project from which it was forked.

Why does Eclipse think there are errors in this source?

EDIT: Eclipse error messages when hovering over errors, for example, Type int64_t could not be resolved and symbol 'cout' could not be resolved .

EDIT: I noticed that Eclipse usually shows a "folder" named includes in a project. This is missing for this project. How can I return it?

enter image description here

+4
source share
5 answers

Eclipse needs to know the paths where the included files can be found. This can be set using general eclipse settings or project by project.

For some reason, it seems that no default paths are set for your current project.

What you can do: Open the project settings and go to C / C ++ General -> Paths and Symbols (at least that's what it is called in my version of eclipse) and fix the include directories.

It might be enough to load the default configuration for this particular project. You may need to tune your tracks yourself. On Unix / OS X, this should usually be usr/include . On Windows, I have no idea, but it should be easy to find out.

Subsequently, you may need to restore your eclipse index (right-click on the project, and then index β†’ ​​rebuild).

If this does not help, share a screenshot of the "Outlines and Symbols" dialog of your project.

Also see the eclipse documentation on this topic.

+3
source

I had to turn on

  • CDT Cross GCC Built-in Compiler Settings
  • CDT GCC Built in Compiler Settings [ Shared ]

in the properties for the project β†’ C / C ++ General β†’ Preprocessor Include paths, macros, etc. β†’ Suppliers

+2
source

Add this definition to Eclipse in Project Properties-> C / C ++ General-> Paths and Symbols

 __STDC_FORMAT_MACROS 

Recover your eclipse index. He will work.

0
source

This worked on Mac OS X Yosemite 10.10.5, version of Eclipse Mars.1 Release (4.5.1):

Since attachments are usually detected by Eclipse through the toolchain, check that you have the actual toolbox set (when I encountered this problem after importing the project, the toolchain was set to β€œNo toolchain.”):

Project β†’ Properties β†’ C / C ++ Build β†’ Tool Chain Editor β†’ Current Tool Chain

If there are no tool chains in the drop-down list, try unchecking "Only display compatible tool nodes" and select a tool chain (I selected Cross GCC). When I saved the changes and re-opened the project properties in order to view this field again, the name "Only compatible software elements" was automatically renamed.

Then reindex the project:

Project β†’ C / C ++ Index β†’ ​​Rebuild

This solved the problem for me (the "pseudo-errors" disappeared, and the included "folder" appeared in my project in the file system view).

0
source

Do you #include d the correct files in your code? For std :: cout, this will be:

 #include <iostream> 

and for int64_t :

 #include stdint.h 
-1
source

Source: https://habr.com/ru/post/1447708/


All Articles