简体   繁体   中英

How to compile C file with system call

My code contains

#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/sched.h>
#include <linux/syscalls.h>

When I used standard gcc, it complains error: linux/init.h: No such file or directory .

So what is the correct way to compile this c file?

Assuming you're running on a Linux box, make sure you have the Linux kernel headers installed, since that file is part of them.

On my system, apt-get install linux-headers would do the trick.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM