Undefined Reference
Matthew Majka
matthew.majka@honeywell.com
Sat Apr 1 00:00:00 GMT 2000
"Eddie CHEUNG [ESD]" wrote:
>
> I just built a cross complier hosted on solaris target to powerpc-elf.
>
> When I test the cross gcc with my hello.c
>
> #include <stdio.h>
> int main()
> {
> printf("Hello World\n");
> return 0;
> }
>
> Errors come up:
>
> /opt/crossgcc/powerpc-elf/bin/gcc hello.c -o hello.o
> /opt/crossgcc/powerpc-elf/bin/ld: warning: cannot find entry symbol _start; defaulting to 01800074
> /var/tmp/ccWKCEit.o: In function `main':
> /var/tmp/ccWKCEit.o(.text+0x20): undefined reference to `printf'
> collect2: ld returned 1 exit status
> make: *** [hello.o] Error 1
>
> It seems to be the linker can not link the standard library. Can anyone help?
GCC does not include libc in the link by default. You must explicitly
include it:
gcc hello.c -o hello -L/path/to/libc.a -lc
As for _start, sounds like powerpc-elf may not include a default crt0.o?
------
Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com
More information about the crossgcc
mailing list