Try gcc -Wl,--no-as-needed -lcap test.c or gcc test.c -lcap.
Hope this helps!

sys/capability.h not found when compiling · Issue #1 · hlandau/acme ...

https://github.com/hlandau/acme.t/issues/1

Dec 3, 2015 ... Running make I get the following error: $ make -e [GO-GET] ... fatal error: sys/ capability.h: No such file or directory #include <sys/capability.h> ...

Source Code FAQ for "The Linux Programming Interface"

https://man7.org/tlpi/code/faq.html

If you encounter the error sys/acl.h: No such file or directory, it is because the required ACL package is not installed on your system. On Debian or Ubuntu, ...

ubuntu and libcap (capabilities) undefined reference - Stack Overflow

https://stackoverflow.com/questions/8338379/ubuntu-and-libcap-capabilities-undefined-reference

with gcc -lcap test.c which gives me the following error: ... Try gcc -Wl,--no-as- needed -lcap test.c or gcc test.c -lcap . Hope this ... I'm working on Ubuntu 10.04 and I had the same problem ( sys/capability.h not present on the file system ). ... which populates the /usr/include/sys folder with the capability.h file.

关于fatal error: sys/capability.h: No such file or directory_C君传 ...

https://blog.csdn.net/buyicn/article/details/80635762

2018年6月9日 ... userns_functions.c:25:28: fatal error: sys/capability.h: No such file or directory compilation terminated. Makefile:17: recipe for target '../libtlpi.a' ...

About fatal error: sys / capability.h: No such file or directory ...

https://www.programmersought.com/article/85853056081/

If you encounter the error sys/capability.h: No such file or directory, it is because a required package is not installed on your system. On Debian or Ubuntu, ...

sys/capability.h :没有那个文件或目录_zyd_15221378768的博客 ...

https://blog.csdn.net/zyd_15221378768/article/details/80046247

2018年4月23日 ... 也就是说,编译程序有了这个软件包,才知道头... 关于fatal error: sys/capability.h: No such file or directory · C君传.

LXD 3.18 - build from source issue on Centos 8 - LXD - Linux ...

https://discuss.linuxcontainers.org/t/lxd-3-18-build-from-source-issue-on-centos-8/8432

Jul 13, 2020 ... Also, the error below came up after I solved this issue . ... fatal error: sys/capability .h: No such file or directory #include <sys/capability.h> ...

Error messages and their solutions - Linuxintro

http://www.linuxintro.org/wiki/Error_messages_and_their_solutions

vdr.c:35:28: fatal error: sys/capability.h: No such file or directory. Solution, in this case for SUSE 11.3 yast -i libcap-devel.

Missing lxc-to-lxd in snap lxd (ubuntu 20.04) - lxd - Linux Containers ...

https://discuss.linuxcontainers.org/t/missing-lxc-to-lxd-in-snap-lxd-ubuntu-20-04/7505

Apr 20, 2020 ... Because of that the lxd-tools package that contains “lxc-to-lxd” is not installed (or I cannot ... fatal error: sys/capability.h: No such file or directory

LIN8-9222 - libtalloc build failure; missing libcap dependency

https://support2.windriver.com/index.php?page=defects&on=view&id=LIN8-9222

May 23, 2018 ... buildtools/bin:$PATH waf build Waf: Entering directory ... fatal error: sys/capability .h: No such file or directory compilation terminated.