I'm following the kernel development tutorial at osdever, and I'm at the printing to the screen portion of the tutorial. It compiles just fine, no errors or warnings, but when it goes to link, I get:
screen.o: In function `scroll':
screen.c:(.text+0x12c): undefined reference to `memcpy'
screen.o: In function `put_str':
screen.c:(.text+0x249): undefined reference to `strlen'
I do have a include statement to system.h at the top of screen.c, and in system.h I have
#ifndef __SYSTEM_H
#define __SYSTEM_H
extern unsigned char *memcpy(unsigned char *dest, const unsigned char *src, int count);
extern unsigned char *memset(unsigned char *dest, unsigned char val, int count);
extern unsigned short *memsetw(unsigned short *dest, unsigned short val, int count);
extern int strlen(const char *str);
extern unsigned char inportb (unsigned short _port);
extern void outportb (unsigned short _port, unsigned char _data);
extern void clear();
extern void put_char(unsigned char c);
extern void put_str(unsigned char *str);
extern void set_color(unsigned char fcol, unsigned char bcol);
extern void init_video();
#endif
I can't find anything about this on the web, and there's no help in the tutorial. It seems that when I change the order in the linker statement, from
/usr/local/cross/bin/i586-elf-ld -T link.ld -o kernel.bin start.o main.o screen.o
to
/usr/local/cross/bin/i586-elf-ld -T link.ld -o kernel.bin start.o screen.o main.o
I get
screen.o: In function `put_str':
screen.c:(.text+0x249): undefined reference to `strlen'
main.o: In function `main':
main.c:(.text+0x9b): undefined reference to `init_video'
Edit http://pastebin.com/ibBAVpe5 - Main.c
nm, try it on the.ofiles.nmoutput you gave, there should not be any undefined references. BTW,Tmarks definitions andUmarks uses. EveryUin your output is matched by aT. So my guess is that you should try puttingmain.ofirst in the list of objects, though that shouldn't be necessary.