Page 1 of 1

linker error

Posted: Thu Apr 01, 2004 12:00 am
by yogie_cs
i downloaded 3 files from this site namely, the c++ kerenl file, the bootloader file and the linker script. the files compiled without any problem. but while linking i am getting an eror as follows " undefined reference to _main"

could anyone please tell why i am geetingthat error and how to rectify it.

RE:linker error

Posted: Thu Apr 01, 2004 12:00 am
by Gnome
That simply means there is no main() function in the object files you're linking together. Since you didn't write this yourself, I would gather that you're not supplying the right arguments when linking. Can you give any more information?

Gnome

RE:linker error

Posted: Sat Apr 03, 2004 12:00 am
by yogie_cs
hi gnome,

the bootloader calls a asm file say myprg.asm

this myprg.asm has a call to function main() as follows:call _main
this main() is present in a c prgram say ker.c.

and both files(myprg.asm and ker.c)compile without any problem
but when i link it as
ld -T link.ld -o hello.bin myprg.o ker.o
it flags an error saying "undefined reference to _main"
pls help me solve this problem