Page 1 of 1

Strange compilation error

Posted: Sat Jul 26, 2014 1:13 pm
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)
          ^

Re: Strange compilation error

Posted: Sat Jul 26, 2014 1:17 pm
by MollenOS
instead of writing "struct regs *r", try to write "regs *r"

Re: Strange compilation error

Posted: Sat Jul 26, 2014 1:57 pm
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)
                  ^

Re: Strange compilation error

Posted: Sat Jul 26, 2014 2:13 pm
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 (...)

Re: Strange compilation error

Posted: Sat Jul 26, 2014 7:42 pm
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.