error: variable or field ‘keyboard’ declared void – implemeting and compiling functions in c++

I writing an operating system project and I’m currently in the process of dealing with IRQs. I have a file (named irq.cpp) where I define the ISR for the keyboard and the timer, which are very simple functions. I also have a header file named “irq.h” that declares the functions I will be using.

here is irq.cpp:

// In this file we will handle the hardware interrupts received from components such as keyboard and timer
#include "irq.h"

void __attribute__((cdecl)) keyboard(Registers* state)
{

    printf((uint8_t*)".");
    if (state->interrupt < 0xA0) PIC_sendEOI(state->interrupt - PIC1); // The input is the irq number
    else PIC_sendEOI(state->interrupt - PIC2);
}

void __attribute__((cdecl)) timer(Registers* state)
{

    printf((uint8_t*)".");
    PIC_sendEOI(state->interrupt - PIC1);

}

void populate_irq_entries()
{

    ISR_RegisterHandler(PIC1 + 0, timer);
    ISR_RegisterHandler(PIC1 + 1, keyboard);
}

The code inside the functions themselves isn’t relevant.

Here is the header file – irq.h:

#ifndef __IRQ_H
#define __IRQ_H
#include "../isr.h"
#include "../../../port/pic.h"
void __attribute__((cdecl)) keyboard(Registers* state);
void __attribute__((cdecl)) timer(Registers* state);
void populate_irq_entries();
#endif

This header file includes a different header file named “isr.h” in which I define a struct that represents the state of the registers before the ISR call:

here is the isr.h:

#ifndef __ISR_H
#define __ISR_H

#include "../../types.h"
#include "../idt.h"
#include "../../gdt/gdt.h"
#include "../../kernel.h"
#include "isrgen.h"

typedef struct
{
    // A useful struct that is used to represnt the values of the registers when pushed into the stack
    // The general ISR_Handler receives a struct of this type and using the values inside it, it deciphers which ISR was called

    uint32_t ds;                                            // data segment pushed by us
    uint32_t edi, esi, ebp, useless, ebx, edx, ecx, eax;    // pusha
    uint32_t interrupt, error;                              // we push interrupt, error is pushed automatically (or dummy)
    uint32_t eip, cs, eflags, esp, ss;                      // pushed automatically by CPU
} __attribute__((packed)) Registers;

typedef void (*ISRHandler)(Registers* regs); // We define a new type - ISRHANDLER is a pointer to a void function that receives the Registers struct as input
ISRHandler ISRHandlers[256]; // Each element in this array is a pointer to a void function - a single isr that receives as input the state of the registers
extern "C" void ISR_Initialize();
void ISR_RegisterHandler(int interrupt, ISRHandler handler);
extern "C" void __attribute__((cdecl)) ISR_Handler(Registers* regs); // cdecl is a calling convention in function. The way it works is that variables are pushed to the stack from right to left and the function is responsible for cleaning in the end of the run

#endif

Most of it isn’t relevant, I just want to show that I define the Registers struct.

When I try to compile the code I get the following error:

In file included from idt/isr/../../kernel.h:13,
                 from idt/isr/isr.h:13,
                 from idt/isr/isr.cpp:1:
idt/isr/../../idt/isr/irq/irq.h:5:29: error: variable or field ‘keyboard’ declared void
    5 | void __attribute__((cdecl)) keyboard(Registers* state);
      |                             ^~~~~~~~
idt/isr/../../idt/isr/irq/irq.h:5:38: error: ‘Registers’ was not declared in this scope; did you mean ‘register’?
    5 | void __attribute__((cdecl)) keyboard(Registers* state);
      |                                      ^~~~~~~~~
      |                                      register
idt/isr/../../idt/isr/irq/irq.h:5:49: error: ‘state’ was not declared in this scope; did you mean ‘static’?
    5 | void __attribute__((cdecl)) keyboard(Registers* state);
      |                                                 ^~~~~
      |                                                 static
idt/isr/../../idt/isr/irq/irq.h:6:29: error: variable or field ‘timer’ declared void
    6 | void __attribute__((cdecl)) timer(Registers* state);
      |                             ^~~~~
idt/isr/../../idt/isr/irq/irq.h:6:35: error: ‘Registers’ was not declared in this scope; did you mean ‘register’?
    6 | void __attribute__((cdecl)) timer(Registers* state);
      |                                   ^~~~~~~~~
      |                                   register
idt/isr/../../idt/isr/irq/irq.h:6:46: error: ‘state’ was not declared in this scope; did you mean ‘static’?
    6 | void __attribute__((cdecl)) timer(Registers* state);
      |                                              ^~~~~
      |                                              static

Does anyone have any idea?

Thanks!

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật