LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 711|回复: 5

this is totally freaking me out(已解决)

[复制链接]
发表于 2006-12-31 07:05:29 | 显示全部楼层 |阅读模式
我只是随便写了个hello.c文件,

int main(int argc, char **argv)

{


    printf("hello the world");



}


然后我想用gcc编译, # gcc hello hello.c


接着就是错误信息

hello.c: In function ‘main’:
hello.c:6: warning: incompatible implicit declaration of built-in function ‘printf’
hello.rodata+0x0): multiple definition of `_fp_hw'
/usr/lib/gcc/i586-suse-linux/4.1.0/../../../crt1.o.rodata+0x0): first defined here
hello: In function `__data_start':
(.data+0x4): multiple definition of `__dso_handle'
/usr/lib/gcc/i586-suse-linux/4.1.0/crtbegin.o.data+0x0): first defined here
hello: In function `_init':
/usr/src/packages/BUILD/glibc-2.4/cc-nptl/csu/crti.S:36: multiple definition of `_init'
/usr/lib/gcc/i586-suse-linux/4.1.0/../../../crti.o:/usr/src/packages/BUILD/glibc-2.4/cc-nptl/csu/crti.S:12: first defined here
hello: In function `_start':
(.text+0x0): multiple definition of `_start'
/usr/lib/gcc/i586-suse-linux/4.1.0/../../../crt1.o:init.c.text+0x0): first defined here
hello: In function `_fini':
/usr/src/packages/BUILD/glibc-2.4/cc-nptl/csu/crti.S:52: multiple definition of `_fini'
/usr/lib/gcc/i586-suse-linux/4.1.0/../../../crti.o:/usr/src/packages/BUILD/glibc-2.4/cc-nptl/csu/crti.S:12: first defined here
hello.rodata+0x4): multiple definition of `_IO_stdin_used'
/usr/lib/gcc/i586-suse-linux/4.1.0/../../../crt1.o.rodata.cst4+0x0): first defined here
hello: In function `__data_start':
(.data+0x0): multiple definition of `__data_start'
/usr/lib/gcc/i586-suse-linux/4.1.0/../../../crt1.o:init.c.data+0x0): first defined here
/tmp/ccESFuun.o: In function `main':
hello.c.text+0x0): multiple definition of `main'
hello.text+0xa4): first defined here
/usr/lib/gcc/i586-suse-linux/4.1.0/../../../../i586-suse-linux/bin/ld: Warning: size of symbol `main' changed from 41 in hello to 38 in /tmp/ccESFuun.o
collect2: ld returned 1 exit status


完全不明白是怎么回事,我是按照教程写的呀。。。。
发表于 2006-12-31 09:26:22 | 显示全部楼层
gcc hello.c -o hello吧,教程这么教的?
回复 支持 反对

使用道具 举报

发表于 2006-12-31 09:28:50 | 显示全部楼层
晕!你都没有用 include <stdio.h>
printf函数未定义!!!
回复 支持 反对

使用道具 举报

发表于 2006-12-31 09:30:33 | 显示全部楼层
#include <stdio.h>

.......

gcc -o hello hello.c
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-12-31 10:41:31 | 显示全部楼层
我错了.........
回复 支持 反对

使用道具 举报

发表于 2006-12-31 11:27:01 | 显示全部楼层
错在哪里了?
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表