Page 1 of 1

Conflicting types but function types are the same

Posted: Wed Jun 25, 2025 5:40 pm
by aether123
I am getting these errors from my code:

Code: Select all

In file included from src/kernel/interrupts/idt.c:2:
src/kernel/interrupts/idt.h:19:25: warning: 'struct InterruptRegisters' declared inside parameter list will not be visible outside of this definition or declaration
   19 | void isr_handler(struct InterruptRegisters* regs);
      |                         ^~~~~~~~~~~~~~~~~~
src/kernel/interrupts/idt.c:135:6: error: conflicting types for 'isr_handler'; have 'void(struct InterruptRegisters *)'
  135 | void isr_handler(struct InterruptRegisters* regs){
      |      ^~~~~~~~~~~
src/kernel/interrupts/idt.h:19:6: note: previous declaration of 'isr_handler' with type 'void(struct InterruptRegisters *)'
   19 | void isr_handler(struct InterruptRegisters* regs);
      |      ^~~~~~~~~~~
make: *** [Makefile:18: includes] Error 1
I've been implementing my IDT, and it should be working fine, but it's saying that my function definitions have conflicting types, any help is much appreciated, thanks in advance

My project files: https://github.com/i-love-winter/SolsticeOS

Re: Conflicting types but function types are the same

Posted: Wed Jun 25, 2025 10:18 pm
by nullplan
The warning tells you what the problem is. Might I suggest getting some more experience with C in userspace before embarking on an OS journey? All of your questions so far have betrayed not just lack of knowledge in operating systems, but also lack of knowledge and experience with the language, and no willing to even just Google the error messages you are getting.

Re: Conflicting types but function types are the same

Posted: Thu Jun 26, 2025 2:07 am
by iansjack
Perhaps not the most obvious of error messages.

Concentrate on the warning, not the errors. It's a good example of why you should be sure that you understand the reason for every warning message that you get.

Re: Conflicting types but function types are the same

Posted: Fri Jun 27, 2025 12:54 am
by aether123
Thankyou for your advice, and I will learn and get more experience with c before I continue this project, and hopefully understand things a lot more

Re: Conflicting types but function types are the same

Posted: Fri Jun 27, 2025 3:09 pm
by MichaelPetch
You get that warning because you haven't actually defined the struct `InterruptRegisters` before using it. To fix that you should include utils.h at the top of idt.h with

Code: Select all

#include "../utils/utils.h"

Re: Conflicting types but function types are the same

Posted: Fri Jun 27, 2025 3:24 pm
by aether123
Thankyou!