linker error

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
yogie_cs

linker error

Post 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.
Gnome

RE:linker error

Post 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
yogie_cs

RE:linker error

Post 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
Post Reply