Page 1 of 1

Linker error - please help!

Posted: Mon Dec 11, 2006 11:06 am
by spookyrufus
Hi there!
I'm following Bran's Kernel Tutorial to develop my very firsti OS.
I just reached the IDT chapter and I'm stuck with an error I'm getting from the linker.

The error message is:

start.o:start.o:(.text+0x53): undefined reference to `_idtp'
main.o:main.c:(.text+0x14f): undefined reference to `_idt_install'

The tutorial I'm following can be found at:

http://www.osdever.net/bkerndev/index.php?the_id=90

PLEASE NOTE that I'm receiving these errors even if I try to compile the tutorial's code itself!

Please someone help to solve this problem. I really can't find a way to do that.
I'm looking forward to receive (good) news (soon)
:D


Andrea

Posted: Mon Dec 11, 2006 1:09 pm
by urxae
I'm guessing you're compiling to ELF format. If so, C functions don't get a leading underscore when accessed from assembly.
The solution is to either remove them from your assembly file or pass '-fleading-underscore' to GCC when compiling the C files.

If you remove them and later want to compile to an object format that does use leading underscores, either pass '-fno-leading-underscore' to GCC or '--prefix _' to NASM.

Posted: Mon Dec 11, 2006 1:12 pm
by oscoder
I'm receiving these errors even if I try to compile the tutorial's code itself
Strange - I downloaded the code at the end of the tutorial, and it seemed to compile and link fine (although there were a few compiler warnings about certain code - but nothing to worry about).

Do you have a script/bat file that compiles and links everything? If so it would help for you to post that (it sounds as though you've forgotten to link in the idt code). If not, could you post the commands you use to build it?

solved!

Posted: Mon Dec 11, 2006 1:34 pm
by spookyrufus
Thanks. I solved the problem and was my mistake.
I forgot to link the idt.o file.
Was getting mad about this problem...now feeling stupid :oops:

Thanks a lot guys, keep up the good work!

Andrea

Re: solved!

Posted: Mon Dec 11, 2006 1:58 pm
by urxae
spookyrufus wrote:Thanks. I solved the problem and was my mistake.
I forgot to link the idt.o file.
That's also a possibility...
I was wondering why you hadn't run in to this sooner :).