Jump to content
  • 0

Help with this error - error: variable has incomplete type 'void'



  • Member

error: variable has incomplete type 'void'

If you are getting this error message trying to compile code that used to work or from some example code you found somewhere it is very likely because of the changes in the XC8 interrupt syntax introduced with V2.0 of XC8.

Specifically I am getting this today for my interrupt service routine definition. I used to use the age-old way of doing this in XC8 as follows:

// Old way to do this

void interrupt  myISR(void) 
   // Old way Interrupt code here

After the changes to the XC8 compiler which were mostly motivated to get better C standard compliance, particularly with C99, the syntax for that function should now use the commonly adopted concept of function declaration-specifier attributes, which traditionally start with 2 underscores and contains either a list of parameters in brackets or have empty brackets if no parameters are present. 

// New and improved and C99 compliant way to specify an interrupt service routine in XC8

void __interrupt() myISR(void)
    // New and improved interrupt code here

This syntax is now also consistent between XC8, XC16 and XC32

Please see this post for more information on how to either work around this or change to the new syntax.


Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet


This topic is now archived and is closed to further replies.


  • Create New...