AlgorithMan-de / wyoos

Source codes for the "Write your own Operating System" video-series on YouTube
http://wyoos.org
GNU General Public License v3.0
719 stars 222 forks source link

Write your own Operating System 5: Interrupts #39

Closed tiagomendes7 closed 6 months ago

tiagomendes7 commented 6 months ago

I am trying to implement the YouTube series "Writing your own OS".

You can find my code at "https://github.com/tiagomendes7/Build_Your_Own_OS/tree/main".

Unfortunately i came across this error and i don't know how to solve it. I believe it has to do with the file "interruptstubs.s" and the code in the line 19 and line 20:

global _ZN16InterruptManager26HandleInterruptRequest\num\()Ev
_ZN16InterruptManager26HandleInterruptRequest\num\()Ev:

Below you can find the output of the command "make mykernel.iso":

as --32 -o loader.o loader.s

g++ -m32 -Iinclude -fno-use-cxa-atexit -nostdlib -fno-builtin -fno-rtti -fno-exceptions -fno-leading-underscore -Wno-write-strings -o port.o -c port.cpp

g++ -m32 -Iinclude -fno-use-cxa-atexit -nostdlib -fno-builtin -fno-rtti -fno-exceptions -fno-leading-underscore -Wno-write-strings -o gdt.o -c gdt.cpp

g++ -m32 -Iinclude -fno-use-cxa-atexit -nostdlib -fno-builtin -fno-rtti -fno-exceptions -fno-leading-underscore -Wno-write-strings -o interrupts.o -c interrupts.cpp

as --32 -o interruptstubs.o interruptstubs.s

g++ -m32 -Iinclude -fno-use-cxa-atexit -nostdlib -fno-builtin -fno-rtti -fno-exceptions -fno-leading-underscore -Wno-write-strings -o kernel.o -c kernel.cpp

ld -melf_i386 -T linkder.ld -o mykernel.bin loader.o port.o gdt.o interrupts.o interruptstubs.o kernel.o

ld: interruptstubs.o: in function `InterruptManager::HandleInterruptRequest0x00()':
(.text+0x0): multiple definition of `InterruptManager::HandleInterruptRequest0x00()'; interrupts.o:interrupts.cpp:(.text+0x34a): first defined here

ld: interruptstubs.o: in function `InterruptManager::HandleInterruptRequest0x01()':
(.text+0xb): multiple definition of `InterruptManager::HandleInterruptRequest0x01()'; interrupts.o:interrupts.cpp:(.text+0x35a): first defined here

make: *** [Makefile:15: mykernel.bin] Error 1
tiagomendes7 commented 6 months ago

UPDATE: It is working now. All that was needed was to remove the definition of HandleInterruptRequest0x00() and HandleInterruptRequest0x01() from interrupts.cpp file.