在ubuntu上编译C代码时遇到问题. (#include错误)

我正在尝试在最新版本的ubuntu上编译一个C程序,以便稍后将编译好的程序放在另一台机器上.但是,当我使用 gcc prog.c -o prog编译时,我收到一个错误:“致命错误:asm / page.h:没有这样的文件或目录”这是标题
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
#include <limits.h>
#include <signal.h>
#include <unistd.h>
#include <sys/uio.h>
#include <sys/mman.h>
#include <asm/page.h>
#include <asm/unistd.h>

我在#include时收到错误.它说致命错误:asm / page.h:没有这样的文件或目录.就像我说的,我只是想编译它.有没有办法让我得到丢失的标题或什么?谢谢.

通常,asm / page.h仅存在于Linux内核树中,通常位于arch /< archname> /asm/page.h下,并且应该仅用于内核代码(或内核模块).

另一方面,stdio.h和stdlib.h不能在内核代码中使用.所以,你原来的源代码看起来最好看.最有可能的是它首先从不需要asm / page.h,实际上它只需要像linux / types.h这样的东西(这是内核的一个asm / page.h包含的头文件之一).

相关文章

目录前言一、创建Hadoop用户二、更新apt和安装Vim编辑器三、...
原文连接:https://www.cnblogs.com/yasmi/p/5192694.html ...
电脑重启后,打开VirtualBox,发现一直用的虚拟机莫名的消失...
参见:https://blog.csdn.net/weixin_38883338/article/deta...
Ubuntu 18.04 LTS 已切换到 Netplan 来配置网络接口。Netpla...
介绍每个 Web 服务都可以通过特定的 URL 在 Internet 上访问...