This is a simple script to check whether there are any unsed headers in C code file.
git clone https://github.com/Kingxukai/check-unused-headers.git
$ cuh --help
- First method
$ which python3
/path/to/python3
use this path in the script first line and then
$ ./cuh file.c
or
$ mkdir -p /usr/local/script
$ cp cuh /usr/local/script/
$ export PATH=/usr/local/script/:$PATH
$ cuh file.c
- Second method
python3 ./cuh file.c
This tool cannot detect structures defined like this:
/* headers.h */
struct values {
int a;
int b;
};
Instead, it incorrectly detects the following:
{'struct values;', 'int a;', 'int b;' }
If you encounter any other issues, feel free to open an issue!
This tool is simpler but less stable
include-what-you-use