wdt.h is included on Arduino IDE.
This example show how it's work:
#include <avr/wdt.h>
int counter=0;
void setup(){
wdt_disable();
Serial.begin(9600);
Serial.println("Starting...");
delay(1000);
wdt_enable(WDTO_8S);
}
void loop(){
wdt_reset();
Serial.println(counter);
counter++;
if(counter==5){
while(true){}
}
delay(500);
}```