Re: How to identify unnecessary include header files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> On 10 Aug 2025, at 20:08, Rajeev Bansal via Gcc-help <gcc-help@xxxxxxxxxxx> wrote:
> 
> I am working on a large C/C++ project compiled with GCC and am looking for
> ways to identify unnecessary header files. I'm wondering if there's a tool
> similar to `include-what-you-use` (IWYU) that can help with this
> information in gcc.

The option -M writes out all dependencies, and one can then check whether a listed include file is in this list:
gcc -M FILE | grep INCLUDE

There might be other options. See:
https://gcc.gnu.org/onlinedocs/gcc/Preprocessor-Options.html






[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux