This project is a Python script that checks and updates C/C++ header files with proper #ifndef guards.
- Recursively searches for .h,.cpp,.c,.hppfiles in a specified directory (default is the current directory).
- Checks if each file contains the #ifndef,#define, and#endifpreprocessor guards.
- If missing, automatically adds the necessary guards to the file.
- Supports dry-run mode where files are only checked, not modified.
- Custom guard name format based on the relative path of the file, ensuring uniqueness.
- 
Clone the repository: git clone https://github.com/BaseMax/c-ifndef-headers.git cd c-ifndef-headers
- 
Install dependencies (if any): pip install -r requirements.txt 
Run the script to check and update header files:
python check_and_update.py /path/to/directoryTo run in dry-run mode (only check files without modifying them):
python check_and_update.py /path/to/directory --dry-runBy default, the script will scan the current directory.
MIT License
Copyright (c) 2025 Max Base