Coder's Cat

Fix missing header files on Ubuntu


When we compile software from source code on Linux system, header file missing is an issue which will happen frequently. Just like this error message:

Usually, you may copy the keyword from error message and search on Google, try to find some missing packages we need to install. But we have a better an unified solution, apt-file is for fixing this kind of issue.

Let’s install apt-file firstly with these command:

sudo apt-get install apt-file 
sudo apt-file update

Then search the header file with it:

coderscat@MININT-ODP168:~/code/espanso$ apt-file search xdo.h
libxdo-dev: /usr/include/xdo.h
libxdo-dev: /usr/share/doc/libxdo-dev/html/structxdo.html

Ok, we get the package name we are missing, install it with apt-get and problem will be solved.

sudo apt-get install libxdo-dev

Another useful command to list files installed by a DEB package:

dpkg --listfiles libxdo-dev

Join my Email List for more insights, It's Free!😋