cannot be resolved" Is there a way to get the Eclipse e...">

Make Eclipse CDT a pre-included header file to avoid the error: "Character <character> cannot be resolved"

Is there a way to get the Eclipse editor to assume that a lit C file is already included without having to explicitly include it?

For example, how can we achieve:

#include "common_type_defs.h"
#include "special_type_defs.h" // Don't want to have to mention this header file

main()
{
  common_type var1;
  special_type var2;
  .....
}

      

just writing:

#include "common_type_def.h"

main()
{
  common_type var1;
  special_type var2; // Eclipse editor: "Symbol 'special_type' could not be resolved"
  .....
}

      

not getting Eclipse editor annotation error: "The character 'special_type' could not be resolved."

The reason is that the project uses a special scripted build system. Special header files are automatically added by the build system selected from different libraries. Thus, the build succeeds.

I added a special header folder to the project include paths. This allows me to press [F3] and go to the definition of "special_type". The editor just posts the error.

I don't want to silence the error because I want to catch real errors.

Any suggestions?

+3


source share


3 answers


Jump to:
Project propertiesthe C / C ++ GeneralPreprocessor includes paths, macros, etc. EntriesGNU C
Select CDT Custom Setting Entries and click the Add button . Select Include file and enter preprocessor prefix file here.

Apply and rebuild the index.



My pre-included ppdefs.h file

I am using Oxygen.1a Release (4.7.1a)

+1


source


Optionally specify in your build system and then:



#ifndef CUSTOMBUILDER
#include "special_type_defs.h" // Don't want to have to mention this header file
#endif

      

+1


source


As a result, I created different "build configurations" for each build option of the build system. There I can add background header files if required.

One drawback is that I have to maintain different build configurations to mirror the build system: when new new header files are added to the build system, the same files must be added to the eclipse build config as well. Thus, this solution will not be suitable for large team projects where several people change included files frequently, because you can easily miss a file or two. But it works well for small teams and infrequent changes.

0


source







All Articles