Strange compilation error

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
bartekww
Posts: 3
Joined: Sat Jul 26, 2014 5:12 am

Strange compilation error

Post by bartekww »

Im using bran tutorial. Now im writing ISRs and i have this error:

Code: Select all

irq.c:26:58: warning: 'struct regs' declared inside parameter list
 void irq_install_handler(int irq, void (*handler)(struct regs *r))
                                                          ^
irq.c:26:58: warning: its scope is only this definition or declaration, which is probably not what you want
irq.c:74:25: warning: 'struct regs' declared inside parameter list
 void irq_handler(struct regs *r)
                         ^
irq.c: In function 'irq_handler':
irq.c:81:29: error: dereferencing pointer to incomplete type
     handler = irq_routines[r->int_no - 32];
                             ^
irq.c:90:10: error: dereferencing pointer to incomplete type
     if (r->int_no >= 40)
          ^
MollenOS
Member
Member
Posts: 202
Joined: Wed Oct 26, 2011 12:00 pm

Re: Strange compilation error

Post by MollenOS »

instead of writing "struct regs *r", try to write "regs *r"
bartekww
Posts: 3
Joined: Sat Jul 26, 2014 5:12 am

Re: Strange compilation error

Post by bartekww »

MollenOS wrote:instead of writing "struct regs *r", try to write "regs *r"

Code: Select all

irq.c:74:18: error: unknown type name 'regs'
 void irq_handler(regs *r)
                  ^
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Strange compilation error

Post by Combuster »

dereferencing pointer to incomplete type
Have you seen the forum rule on Required Knowledge?
wiki wrote:Not only should you know the language in which you will be developing inside out (...)
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
alexfru
Member
Member
Posts: 1112
Joined: Tue Mar 04, 2014 5:27 am

Re: Strange compilation error

Post by alexfru »

bartekww wrote:Im using bran tutorial. Now im writing ISRs and i have this error:

Code: Select all

irq.c:26:58: warning: 'struct regs' declared inside parameter list
 void irq_install_handler(int irq, void (*handler)(struct regs *r))
                                                          ^
irq.c:26:58: warning: its scope is only this definition or declaration, which is probably not what you want
irq.c:74:25: warning: 'struct regs' declared inside parameter list
 void irq_handler(struct regs *r)
                         ^
irq.c: In function 'irq_handler':
irq.c:81:29: error: dereferencing pointer to incomplete type
     handler = irq_routines[r->int_no - 32];
                             ^
irq.c:90:10: error: dereferencing pointer to incomplete type
     if (r->int_no >= 40)
          ^
You don't have struct regs declared anywhere. Did you forget to declare it? Did you delete the declaration? Did you not #include a file that declares it? Was there a typo in the declaration, e.g. struct Regs or struct reg or struct reggs, etc?

Come on, the error issued by the compiler is pretty clear. Unless, of course, you're a complete C newbie.
Post Reply