"Included header ... is not used directly..."
Hello there,
I have a strange warning and the quick fix suggestion is to remove the include statement which doesn't make sense.
Any ideas what's triggering this warning? And how to fix it properly?
Thanks and regards,
Johannes
-
The diagnostic warning comes from clangd. The warning indicates that the header file is not being used directly, i.e. there is nothing defined or declared in the header file that is being used by the module including it. This can happen when you include a header file to include another header file that is being used.
A specific warning can be removed by appending a "IWYU pragma: keep" comment to the include. For example:
#include "stm32l011xx.h" // IWYU pragma: keep
The warnings can be disabled by putting the following text in a file named .clangd located in your source tree (clangd searches in all parent directories of the active file for this file):
Diagnostics:
UnusedIncludes: NoneThere is more information on this at https://clangd.llvm.org/guides/include-cleaner
Please sign in to leave a comment.
Comments
1 comment