有关gcc的编译问题(急)

软件和网站开发以及相关技术探讨
回复
mlqq
帖子: 2
注册时间: 2008-04-22 21:42

有关gcc的编译问题(急)

#1

帖子 mlqq » 2008-05-26 17:33

在安装了ubuntu的虚拟机上用gcc -o fork fork.c编译文件fork.c的时候出现如下提示:
fork.c:1:20: 错误: string.h:No such file or directory
fork.c:2:19: 错误: stdio.h:No such file or directory
fork.c:3:19: 错误: errno.h:No such file or directory
fork.c: 在函数 ‘main’ 中:
fork.c:13: 错误: ‘NULL’ 未声明 (在此函数内第一次使用)
fork.c:13: 错误: (即使在一个函数内多次出现,每个未声明的标识符在其
fork.c:13: 错误: 所在的函数内只报告一次。)
fork.c:18: 警告: 隐式声明与内建函数 ‘exit’ 不兼容
fork.c:18: 错误: ‘errno’ 未声明 (在此函数内第一次使用)
请问各位大虾,这是什么原因?要怎么样才能编译通过?
dbzhang800
帖子: 3182
注册时间: 2006-03-10 15:10
来自: xi'an China
联系:

#2

帖子 dbzhang800 » 2008-05-26 17:36

http://wiki.ubuntu.org.cn/Gcchowto

先把编译环境装上
mlqq
帖子: 2
注册时间: 2008-04-22 21:42

#3

帖子 mlqq » 2008-05-26 17:52

装上编译环境之后再次编译,出现了这个:
fork.c: 在函数 ‘main’ 中:
fork.c:18: 警告: 隐式声明与内建函数 ‘exit’ 不兼容
还是无法理解啊
头像
BigSnake.NET
帖子: 12522
注册时间: 2006-07-02 11:16
来自: 廣州
联系:

#4

帖子 BigSnake.NET » 2008-05-26 17:57

你不贴代码谁也无法理解
^_^ ~~~
要理解递归,首先要理解递归。

地球人都知道,理论上,理论跟实际是没有差别的,但实际上,理论跟实际的差别是相当大滴。
qyll17
帖子: 10
注册时间: 2008-05-03 17:20

#5

帖子 qyll17 » 2008-05-28 12:42

这没关系啊,不就是警告吗?可以运行就可以了
头像
alphauslee
帖子: 5
注册时间: 2008-04-25 20:46
来自: 广西

#6

帖子 alphauslee » 2008-06-07 0:09

[quote="mlqq"]装上编译环境之后再次编译,出现了这个:
fork.c: 在函数 ‘main’ 中:
fork.c:18: 警告: 隐式声明与内建函数 ‘exit’ 不兼容
还是无法理解啊[/quote]

加上#include <stdlib.h>
Ubuntu
laiwf
帖子: 4
注册时间: 2008-05-07 23:43

#7

帖子 laiwf » 2008-06-07 2:04

加上头文件#include<stdlib.h>就可以了
头像
s4426565
帖子: 34
注册时间: 2007-10-24 1:37

#8

帖子 s4426565 » 2008-06-07 19:28

dbzhang800 说的没有错 你的错误是 string.h:No such file or directory 表示 库都没有装上 按照 http://wiki.ubuntu.org.cn/Gcchowto 去安装就可以解决了
A man travels the world in search of what he needs and returns home to find it
头像
s4426565
帖子: 34
注册时间: 2007-10-24 1:37

#9

帖子 s4426565 » 2008-06-07 19:28

给出代码
A man travels the world in search of what he needs and returns home to find it
回复