alteration
alteration

Reputation: 53

Linux, can't include sys modules

When I try to include a sys module (for example #include <sys/shm.h>) i get the following error: No such file or directory. Can't find any working solution on internet. The language used is C.

Upvotes: 1

Views: 1122

Answers (2)

J&#233;r&#244;me Pouiller
J&#233;r&#244;me Pouiller

Reputation: 10257

In your question, you didn't specify you was trying to compile a kernel module.

User space libraries (and user space function) are not available in kernel. That's why you can't include user space headers. You have to develop only with functions provided by kernel.

Upvotes: 1

J&#233;r&#244;me Pouiller
J&#233;r&#244;me Pouiller

Reputation: 10257

glibc headers are surely not installed (you may have just installed gcc without glibc headers).

If you run Ubuntu/Debian, this command should solve your issue:

sudo apt-get install libc-dev

Note: linux/shm.h and sys/shm.h are not the same. linux/shm.h is provided by Linux kernel and is not intended to be used by normal developer.

Upvotes: 0

Related Questions