Error linking when including header files with barebones
Posted: Sun Oct 29, 2023 2:11 pm
Hello.
I've followed the barebones tutorial and got it to run in qemu. Now i'm trying to put some code in another file, test.{h,c}, but i get an error linking. There are no errors/messages compiling kernel.c. The error i get is:
and the command i'm running is
Everything else is the same as the barebones tutorial.
Any help would be appreciated.
Thanks!
I've followed the barebones tutorial and got it to run in qemu. Now i'm trying to put some code in another file, test.{h,c}, but i get an error linking. There are no errors/messages compiling kernel.c. The error i get is:
Code: Select all
/home/billy/opt/cross/lib/gcc/i686-elf/13.2.0/../../../../i686-elf/bin/ld: ../obj/kernel.o: in function `kernel_main':
kernel.c:(.text+0x445): undefined reference to `TestFunc'
collect2: error: ld returned 1 exit status
Code: Select all
i686-elf-gcc -T ../linker.ld -o ../bin/kernel.bin -ffreestanding -O2 -nostdlib ../obj//kernel.o -lgcc
Any help would be appreciated.
Thanks!