What’s a good way to fix missing-dependency errors such as:

include/prog.h:17:10: fatal error: file.h: No such file or directory
   17 | #include <file.h>
      |          ^~~~~~~

?

Define this Bash function:

lo() (
  locate -b "\\$1"
)

it matches exact basenames and can be called like lo file.h. If the above command succeeds it’ll return a file path that can be included in the compilation command.

If the above command fails, one has to install the package containing the missing file. To find such package:

# RHEL/Fedora/CentOS
dnf whatprovides */file.h

# Debian/Ubuntu
dpkg -S */file.h