关于hello.c的问题

软件和网站开发以及相关技术探讨
回复
petertsi
帖子: 2
注册时间: 2008-07-29 0:10

关于hello.c的问题

#1

帖子 petertsi » 2008-07-29 0:16

zhengqi@zhengqi-laptop:~$ gcc hello.c -o hello
hello.c:2:19: 错误: stdio.h:没有该文件或目录
hello.c: 在函数‘main’中:
hello.c:6: 警告: 内建函数 ‘printf’ 不兼容的隐式声明
编译器说找不到头文件请问如何解决?
版本号4.2.3,尝试过用-l 指定目录也不行。(不是很清楚GCC的头文件库到底放在哪里,于TC的库有什么区别)
hello.c:
#include <stdio.h>
int main(void)
{
printf("hello world");
return 0;
}
头像
pro711
帖子: 42
注册时间: 2008-06-15 7:47
来自: 上海

#2

帖子 pro711 » 2008-07-29 19:31

是不是没装libc6-dev?
头像
leeaman
帖子: 30702
注册时间: 2007-02-02 18:14
系统: debian sid

#3

帖子 leeaman » 2008-07-29 20:08

看wiki,要装那个build-ess?那个包才可以
醉了星星,醉月亮●●●●●The Long Way To Go(*^_^*)
头像
newman0708
帖子: 188
注册时间: 2007-09-22 13:09

#4

帖子 newman0708 » 2008-07-29 21:08

sudo apt-get install build-essential
petertsi
帖子: 2
注册时间: 2008-07-29 0:10

#5

帖子 petertsi » 2008-07-30 12:34

呵呵,解决了,谢谢各位,看来以后要多看看 wiki了。
ps:编译时出现
/tmp/cc2eY0iB.o:(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld 返回 1
是什么意思?
回复