Adding
#include <sys/types.h>
#include <sys/stat.h>

in ExternalInput