|
|
|
|
| When build hello step by step, I get an error, why |
 When build hello step by step, I get an error, why - qizihuang [ 2006-08-02 11:51 | 735 byte(s)]
 Re: When build hello step by step, I get an error, why - asmcos [ 2006-08-02 13:40 | 21 byte(s)]
 Re: When build hello step by step, I get an error, why - qizihuang [ 2006-08-02 14:06 | 801 byte(s)]
 Re: When build hello step by step, I get an error, why - asmcos [ 2006-08-02 14:36 | 35 byte(s)]
 Re: When build hello step by step, I get an error, why - qizihuang [ 2006-08-02 15:30 | 93 byte(s)]
|
|
|
|
[Original]
[Print]
[Top]
|
# cat hello.c
#include <stdio.h>
int main(int argc, char **argv)
{
printf("Hello World!");
return 0;
}
# gcc -c -o hello.o hello.c
# echo $?
0
# ld -o hello -L./libc.a hello.o -L/usr/lib/gcc/i586-suse-linux/4.1.0/libgcc.a -L/usr/lib/gcc/i586-suse-linux/4.1.0/libgcc_eh.a
ld: warning: cannot find entry symbol _start; defaulting to 0000000008048094
hello.o: In function `main':
hello.c:(.text+0x19): undefined reference to `printf'
I want to debug glibc, so create libc.a myself here, you can use /usr/lib/libc.a to reproduce this problem.
|
|
|
[Original]
[Print]
[Top]
|
|
[Original]
[Print]
[Top]
|
oops!
# ld -o hello hello.o /usr/lib/gcc/i586-suse-linux/4.1.0/../../../crt1.o /usr/lib/gcc/i586-suse-linux/4.1.0/../../../crti.o /usr/lib/gcc/i586-suse-linux/4.1.0/crtbeginT.o -L/usr/lib/libc.a -L/usr/lib/gcc/i586-suse-linux/4.1.0/libgcc.a -L/usr/lib/gcc/i586-suse-linux/4.1.0/libgcc_eh.a /usr/lib/gcc/i586-suse-linux/4.1.0/crtend.o /usr/lib/gcc/i586-suse-linux/4.1.0/../../../crtn.o
/usr/lib/gcc/i586-suse-linux/4.1.0/../../../crt1.o: In function `_start':
init.c:(.text+0xc): undefined reference to `__libc_csu_fini'
init.c:(.text+0x11): undefined reference to `__libc_csu_init'
init.c:(.text+0x1d): undefined reference to `__libc_start_main'
hello.o: In function `main':
hello.c:(.text+0x19): undefined reference to `printf'
|
|
|
[Original]
[Print]
[Top]
|
|
[Original]
[Print]
[Top]
|
|
Do you think I have no default ld.script? why? I have installed gcc from official SLES10 GMC.
|
|
|
[Original]
[Print]
[Top]
|
|
|