AntumDeluge
AntumDeluge

Reputation: 500

Suppress "Unresolved Inclusion" Warning In Eclipse/CDT?

I have found plenty of answers on how to fix "include" errors/warnings by listing header directories in Properties -> C/C++ General -> Paths and Symbols -> Includes. However, I am trying to find out if it is possible to suppress a warning for an included header that intentionally does not exist.

The file in this instance is named config.h and it is generated from another file named config.h.in after invoking the cmake build tool. So there is no problem compiling the code. I just get the highlighted warning "Unresolved inclusion" in eclipse. I am looking to suppress this warning but don't know if it is possible.

unresolved-inclusion.png

I have tried the following but does not work:

#include "config.h" // @suppress("Unresolved inclusion")

Obviously not a severe problem, but would be nice to be able to suppress it.

Upvotes: 0

Views: 735

Answers (1)

HighCommander4
HighCommander4

Reputation: 52749

I don't know of a way to suppress individual "Unresolved inclusion" annotations, but I can explain why @suppress doesn't work for them.

There are two sources of error/warning annotations in Eclipse CDT:

  1. Ones that come from the Code Analysis (CodAn) module. This includes semantic errors, and warnings. (You can see a list of these in Preferences | C/C++ | Code Analysis.)
  2. Ones that come directly from the indexer. This includes syntax errors, and preprocessor errors (including unresolved inclusion errors).

@suppress is a CodAn feature, and as such, it only applies to CodAn annotations.

I'm not aware of a similar feature for the second kind of annotation, beyond hiding this entire category in Preferences | General | Editors | Text Editors | Annotations | C/C++ Indexer Markers.

Upvotes: 3

Related Questions