• AVR Freaks

Hot!Interrupt error:variable has incomplete type void

Page: 12 > Showing page 1 of 2
Author
nbrucew
New Member
  • Total Posts : 22
  • Reward points : 0
  • Joined: 2007/08/13 20:01:26
  • Location: 0
  • Status: offline
2020/08/03 19:12:26 (permalink)
0

Interrupt error:variable has incomplete type void

Beginner using PIC 12F1501 .. MPLX IDE V5.20 ...XC8 v2.05 .. PICKIT3
Trying to learn interrupts in C .. simple program complies but error as below: 
Interrupts/EC_L5_1a-Flash_LED-50p-int.c:86:6: error: variable has incomplete type 'void
Tried several pic mcu's, several example programs and always same result .. believe code is correct .. and don't understand error message 
ANY suggestions would surely be appreciated .. just frustrated newbie 
Just simple program to blink a damn LED !!!
#include <xc.h>
 
#pragma config MCLRE = ON, FOSC = INTOSC, CLKOUTEN = OFF, WDTE = OFF
#pragma config BOREN = ON, BORV = LO, LPBOR = OFF
#pragma config PWRTE = OFF, CP = OFF, WRT = OFF
#pragma config STVREN = ON, LVP = OFF
 
#define F_LED LATAbits.LATA0 // flashing LED

/***** MAIN PROGRAM *****/
void main()
{

LATA = 0; // start with all output pins low (LED off)
TRISA = 0b111110; // configure RA0 (only) as an output

OSCCONbits.SCS1 = 1; // select internal clock
OSCCONbits.IRCF = 0b0111; // internal oscillator = 500 kHz

OPTION_REGbits.TMR0CS = 0; // select timer mode
OPTION_REGbits.PSA = 0; // assign prescaler to Timer0
OPTION_REGbits.PS = 0b111; // prescale = 256
INTCONbits.TMR0IE = 1; // enable Timer0 interrupt
ei(); // enable global interrupts

//*** Main loop
for (;;)
{
; // (do nothing)
}
}

/***** INTERRUPT SERVICE ROUTINE *****/
void __interrupt isr(void)
{
//*** Service Timer0 interrupt
//
// TMR0 overflows every 524 ms
//
// Flashes LED at ~0.95 Hz by toggling on each interrupt
// (every ~524 ms)
//
// (only Timer0 interrupts are enabled)
//
INTCONbits.TMR0IF = 0; // clear interrupt flag

// toggle LED
F_LED = ~F_LED;
}
 
#1

25 Replies Related Threads

    ric
    Super Member
    • Total Posts : 28386
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: Interrupt error:variable has incomplete type void 2020/08/03 19:24:50 (permalink)
    +1 (1)
    Not your problem, but
    void main()

    should be
    void main(void)

    they are not the same in C (as opposed to C++)
     
     
    void __interrupt isr(void)

    should be
    void __interrupt() isr(void)

     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #2
    ric
    Super Member
    • Total Posts : 28386
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: Interrupt error:variable has incomplete type void 2020/08/03 19:26:14 (permalink)
    +1 (1)
    also note, the #include for xc.h should be AFTER the config settings.
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #3
    JPortici
    Super Member
    • Total Posts : 1164
    • Reward points : 0
    • Joined: 2012/11/17 06:27:45
    • Location: Grappaland
    • Status: offline
    Re: Interrupt error:variable has incomplete type void 2020/08/04 00:25:34 (permalink)
    +1 (1)
    is this the real code? this listing doesn't have 86 rows..
    #4
    ric
    Super Member
    • Total Posts : 28386
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: Interrupt error:variable has incomplete type void 2020/08/04 00:31:09 (permalink)
    +1 (1)
    Woudn't be the first time an OP has left out chunks of lines they thought "didn't matter".
    I'm confident I've identified the problem, but it doesn't help when the code shown is NOT the real code that generated the error.

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #5
    1and0
    Access is Denied
    • Total Posts : 11143
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: Interrupt error:variable has incomplete type void 2020/08/04 06:32:18 (permalink)
    0
    Switch to C90 mode, or fix the __interrupt() specifier as pointed out by Ric for C99 mode.
     
    #6
    nbrucew
    New Member
    • Total Posts : 22
    • Reward points : 0
    • Joined: 2007/08/13 20:01:26
    • Location: 0
    • Status: offline
    Re: Interrupt error:variable has incomplete type void 2020/08/04 11:46:06 (permalink)
    0 (2)
    Thankyou for response ... cut and paste left out some code .. following is actual code .. taking lesson on C from Gooligum and using PIC12F1501, MPLX v5.20, XC8 v2.05, pickit3I  I included error statement .. did include in program suggestions made .. edited program for Gooligum comments to shorten reading .. have tried other interrupt simple programs thinking Gooligum is issue but same result Thanks
     
    ../../GooligumTutorials/Enhanced_C_brd-151108/Enhanced C/5 - Interrupts/EC_L5_1a-Flash_LED-50p-int.c:85:29: error: expected ';' after top level declarator
    void __interrupt() isr(void) 
    ^
    ;
    ../../GooligumTutorials/Enhanced_C_brd-151108/Enhanced C/5 - Interrupts/EC_L5_1a-Flash_LED-50p-int.c:85:385: error: variable has incomplete type 'void'
    void __interrupt() isr(void) 
    ^
    ../../GooligumTutorials/Enhanced_C_brd-151108/Enhanced C/5 - Interrupts/EC_L5_1a-Flash_LED-50p-int.c:85:396: error: expected ';' after top level declarator
    void __interrupt() isr(void) 
     
    ***** CONFIGURATION *****/
    // ext reset, internal oscillator (no clock out), no watchdog timer
    #pragma config MCLRE = ON, FOSC = INTOSC, CLKOUTEN = OFF, WDTE = OFF
    // brownout resets enabled, low brownout voltage, no low-power brownout reset
    #pragma config BOREN = ON, BORV = LO, LPBOR = OFF
    // no power-up timer, no code protect, no write protection
    #pragma config PWRTE = OFF, CP = OFF, WRT = OFF
    // stack resets on, high-voltage programming
    #pragma config STVREN = ON, LVP = OFF
    #include <xc.h>
    // Pin assignments
    #define F_LED LATAbits.LATA0 // flashing LED

    /***** MAIN PROGRAM *****/
    void main(void)
    {
    LATA = 0; // start with all output pins low (LED off)
    TRISA = 0b111110; // configure RA0 (only) as an output

    // configure oscillator
    OSCCONbits.SCS1 = 1; // select internal clock
    OSCCONbits.IRCF = 0b0111; // internal oscillator = 500 kHz
    // -> 8 us / instruction cycle

    // configure Timer0
    OPTION_REGbits.TMR0CS = 0; // select timer mode
    OPTION_REGbits.PSA = 0; // assign prescaler to Timer0
    OPTION_REGbits.PS = 0b111; // prescale = 256
    // -> increment TMR0 every 2048 us
    // enable interrupts
    INTCONbits.TMR0IE = 1; // enable Timer0 interrupt
    ei(); // enable global interrupts

    //*** Main loop
    for (;;)
    {
    ; // (do nothing)
    }
    }

    /***** INTERRUPT SERVICE ROUTINE *****/
    void __interrupt() isr(void) 
    {
    INTCONbits.TMR0IF = 0; // clear interrupt flag
    F_LED = ~F_LED;
    }
    #7
    ric
    Super Member
    • Total Posts : 28386
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: Interrupt error:variable has incomplete type void 2020/08/04 13:39:29 (permalink)
    +2 (2)
    Can you attach the file you are compiling?
    The code you posted appears to start with an incomplete comment line, and the error is reported on line 85, but you only posted 46 lines of code.
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #8
    dan1138
    Super Member
    • Total Posts : 3845
    • Reward points : 0
    • Joined: 2007/02/21 23:04:16
    • Location: 0
    • Status: offline
    Re: Interrupt error:variable has incomplete type void 2020/08/04 14:13:33 (permalink)
    0
    ric,
     
    This is the file that nbrucew should be building:
    /************************************************************************
    *                                                                       *
    *   Filename:      EC_L5_1a-Flash_LED-50p-int.c                         *
    *   Date:          15/2/14                                              *
    *   File Version:  1.0.1                                                *
    *                                                                       *
    *   Author:        David Meiklejohn                                     *
    *   Company:       Gooligum Electronics                                 *
    *                                                                       *
    *************************************************************************
    *                                                                       *
    *   Architecture:  Enhanced Mid-range PIC                               *
    *   Processor:     12F1501                                              *
    *   Compiler:      MPLAB XC8 v2.20 (Free mode)                          *
    *                                                                       *
    *************************************************************************
    *                                                                       *
    *   Files required: none                                                *
    *                                                                       *
    *************************************************************************
    *                                                                       *
    *   Description:    Lesson 5, example 1a                                *
    *                                                                       *
    *   Demonstrates use of Timer0 interrupt to perform a background task   *
    *                                                                       *
    *   Flash an LED approximately once per second (50% duty cycle)         *
    *                                                                       *
    *************************************************************************
    *                                                                       *
    *   Pin assignments:                                                    *
    *       RA0 = flashing LED                                              *
    *                                                                       *
    *************************************************************************
    *                                                                       *
    *   Updated: 2020-08-04                                                 *
    *       Change interrupt function attribute to __interrupt()            *
    *       for XC8 v2.20 in C99 mode.                                      *
    *                                                                       *
    ************************************************************************/

    #include <xc.h>


    /***** CONFIGURATION *****/
    //  ext reset, internal oscillator (no clock out), no watchdog timer
    #pragma config MCLRE = ON, FOSC = INTOSC, CLKOUTEN = OFF, WDTE = OFF
    //  brownout resets enabled, low brownout voltage, no low-power brownout reset
    #pragma config BOREN = ON, BORV = LO, LPBOR = OFF
    //  no power-up timer, no code protect, no write protection
    #pragma config PWRTE = OFF, CP = OFF, WRT = OFF
    //  stack resets on, high-voltage programming
    #pragma config STVREN = ON, LVP = OFF

    // Pin assignments
    #define F_LED   LATAbits.LATA0      // flashing LED


    /***** MAIN PROGRAM *****/
    void main()
    {
        //*** Initialisation
        
        // configure port
        LATA = 0;                   // start with all output pins low (LED off)
        TRISA = 0b111110;           // configure RA0 (only) as an output
        
        // configure oscillator
        OSCCONbits.SCS1 = 1;        // select internal clock
        OSCCONbits.IRCF = 0b0111;   // internal oscillator = 500 kHz
                                    //  -> 8 us / instruction cycle
            
        // configure Timer0
        OPTION_REGbits.TMR0CS = 0;      // select timer mode
        OPTION_REGbits.PSA = 0;         // assign prescaler to Timer0
        OPTION_REGbits.PS = 0b111;      // prescale = 256
                                        //  -> increment TMR0 every 2048 us   

        // enable interrupts
        INTCONbits.TMR0IE = 1;          // enable Timer0 interrupt
        ei();                           // enable global interrupts

                                        
        //*** Main loop
        for (;;)
        {
            ;   // (do nothing)
        }
    }


    /***** INTERRUPT SERVICE ROUTINE *****/
    void __interrupt() isr(void)
    {
        //*** Service Timer0 interrupt
        //
        //  TMR0 overflows every 524 ms
        //
        //  Flashes LED at ~0.95 Hz by toggling on each interrupt
        //      (every ~524 ms)
        //
        //  (only Timer0 interrupts are enabled)
        //    
        INTCONbits.TMR0IF = 0;          // clear interrupt flag
        
        // toggle LED
        F_LED = ~F_LED;              
    }

    #9
    nbrucew
    New Member
    • Total Posts : 22
    • Reward points : 0
    • Joined: 2007/08/13 20:01:26
    • Location: 0
    • Status: offline
    Re: Interrupt error:variable has incomplete type void 2020/08/04 14:18:34 (permalink)
    0
    Attached is total file ... also with some research I have converted to C99 syntax .. using XC8--cc(V2.05) driver .. just hope I did all correctly ..
    /************************************************************************
    * *
    * Filename: EC_L5_1a-Flash_LED-50p-int.c *
    * Date: 15/2/14 *
    * File Version: 1.0 *
    * *
    * Author: David Meiklejohn *
    * Company: Gooligum Electronics *
    * *
    *************************************************************************
    * *
    * Architecture: Enhanced Mid-range PIC *
    * Processor: 12F1501 *
    * Compiler: MPLAB XC8 v1.30 (Free mode) *
    * *
    *************************************************************************
    * *
    * Files required: none *
    * *
    *************************************************************************
    * *
    * Description: Lesson 5, example 1a *
    * *
    * Demonstrates use of Timer0 interrupt to perform a background task *
    * *
    * Flash an LED approximately once per second (50% duty cycle) *
    * *
    *************************************************************************
    * *
    * Pin assignments: *
    * RA0 = flashing LED *
    * *
    ************************************************************************/
     

    /***** CONFIGURATION *****/
    // ext reset, internal oscillator (no clock out), no watchdog timer
    #pragma config MCLRE = ON, FOSC = INTOSC, CLKOUTEN = OFF, WDTE = OFF
    // brownout resets enabled, low brownout voltage, no low-power brownout reset
    #pragma config BOREN = ON, BORV = LO, LPBOR = OFF
    // no power-up timer, no code protect, no write protection
    #pragma config PWRTE = OFF, CP = OFF, WRT = OFF
    // stack resets on, high-voltage programming
    #pragma config STVREN = ON, LVP = OFF
    #include <xc.h>
    // Pin assignments
    #define F_LED LATAbits.LATA0 // flashing LED

    /***** MAIN PROGRAM *****/
    void main(void)
    {
    LATA = 0; // start with all output pins low (LED off)
    TRISA = 0b111110; // configure RA0 (only) as an output

    // configure oscillator
    OSCCONbits.SCS1 = 1; // select internal clock
    OSCCONbits.IRCF = 0b0111; // internal oscillator = 500 kHz
    // -> 8 us / instruction cycle

    // configure Timer0
    OPTION_REGbits.TMR0CS = 0; // select timer mode
    OPTION_REGbits.PSA = 0; // assign prescaler to Timer0
    OPTION_REGbits.PS = 0b111; // prescale = 256
    // -> increment TMR0 every 2048 us
    // enable interrupts
    INTCONbits.TMR0IE = 1; // enable Timer0 interrupt
    ei(); // enable global interrupts

    //*** Main loop
    for (;;)
    {
    ; // (do nothing)
    }
    }

    /***** INTERRUPT SERVICE ROUTINE *****/
    void __interrupt() timer(void) 
    {

    INTCONbits.TMR0IF = 0; // clear interrupt flag

    // toggle LED
    F_LED = ~F_LED;
    }
     
    #10
    ric
    Super Member
    • Total Posts : 28386
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: Interrupt error:variable has incomplete type void 2020/08/04 15:18:58 (permalink)
    +1 (1)
    nbrucew
    Attached is total file ... also with some research I have converted to C99 syntax .. using XC8--cc(V2.05) driver .. just hope I did all correctly ..

    To select the C syntax, all you need do is select it in the project settings, under "XC8 Global Options", "C standard".
    I just compiled your exact source in both C90 and C99 mode, and it worked in both.
    (There was a
    temp.c:83:33: warning: (373) implicit signed to unsigned conversion

    warning in C90 mode, no warnings at all in C99 mode.
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #11
    nbrucew
    New Member
    • Total Posts : 22
    • Reward points : 0
    • Joined: 2007/08/13 20:01:26
    • Location: 0
    • Status: offline
    Re: Interrupt error:variable has incomplete type void 2020/08/04 18:16:17 (permalink)
    0
    I could not get previous program to work and know I used C99 syntax .. so loaded another example problem below and also error statements .. same result ??
     
    /************************************************************************
    * *
    * Filename: EC_L5_1b-Flash_LED-50p-1Hz.c *
    * Date: 15/2/14 *
    * File Version: 1.0 *
    * *
    * Author: David Meiklejohn *
    * Company: Gooligum Electronics *
    * *
    *************************************************************************
    * *
    * Architecture: Enhanced Mid-range PIC *
    * Processor: 12F1501 *
    * Compiler: MPLAB XC8 v1.30 (Free mode) *
    * *
    *************************************************************************
    * *
    * Files required: none *
    * *
    *************************************************************************
    * *
    * Description: Lesson 5, example 1b *
    * *
    * Demonstrates use of Timer0 interrupt to perform a background task *
    * *
    * Flash an LED at exactly 1 Hz (50% duty cycle). *
    * *
    *************************************************************************
    * *
    * Pin assignments: *
    * RA0 = flashing LED *
    * *
    ************************************************************************/
    #include <xc.h>
    #include <stdint.h>

    /***** CONFIGURATION *****/
    // ext reset, internal oscillator (no clock out), no watchdog timer
    #pragma config MCLRE = ON, FOSC = INTOSC, CLKOUTEN = OFF, WDTE = OFF
    // brownout resets enabled, low brownout voltage, no low-power brownout reset
    #pragma config BOREN = ON, BORV = LO, LPBOR = OFF
    // no power-up timer, no code protect, no write protection
    #pragma config PWRTE = OFF, CP = OFF, WRT = OFF
    // stack resets on, high-voltage programming
    #pragma config STVREN = ON, LVP = OFF
    // Pin assignments
    #define F_LED LATAbits.LATA0 // flashing LED

    /***** MAIN PROGRAM *****/
    void main()
    {
    //*** Initialisation

    // configure port
    LATA = 0; // start with all output pins low (LED off)
    TRISA = 0b111110; // configure RA0 (only) as an output

    // configure oscillator
    OSCCONbits.SCS1 = 1; // select internal clock
    OSCCONbits.IRCF = 0b0111; // internal oscillator = 500 kHz
    // -> 8 us / instruction cycle

    // configure Timer0
    OPTION_REGbits.TMR0CS = 0; // select timer mode
    OPTION_REGbits.PSA = 1; // no prescaling
    // -> increment TMR0 every 8 us
    // enable interrupts
    INTCONbits.TMR0IE = 1; // enable Timer0 interrupt
    ei(); // enable global interrupts

    //*** Main loop
    for (;;)
    {
    ; // (do nothing)
    }
    }

    /***** INTERRUPT SERVICE ROUTINE *****/
    void __interrupt isr(void)
    {
    static uint8_t cnt_t0 = 0; // counts timer0 interrupts

    //*** Service Timer0 interrupt
    //
    // TMR0 overflows every 2 ms
    //
    // Flashes LED at 1 Hz by toggling on every 250th interrupt
    // (every 500 ms)
    //
    // (only Timer0 interrupts are enabled)
    //
    INTCONbits.TMR0IF = 0; // clear interrupt flag

    TMR0 += 256-250+3; // add value to Timer0
    // for overflow after 250 counts

    // toggle LED every 500 ms
    ++cnt_t0; // increment interrupt count (every 2 ms)
    if (cnt_t0 == 500/2) // if count overflow (every 500 ms)
    {
    cnt_t0 = 0; // reset count
    F_LED = ~F_LED; // toggle LED
    }
    }
    ../../GooligumTutorials/Enhanced_C_brd-151108/Enhanced C/5 - Interrupts/EC_L5_1b-Flash_LED-50p-1Hz.c:86:6: error: variable has incomplete type 'void'
    void __interrupt isr(void)
    ^
    ../../GooligumTutorials/Enhanced_C_brd-151108/Enhanced C/5 - Interrupts/EC_L5_1b-Flash_LED-50p-1Hz.c:86:17: error: expected ';' after top level declarator
    void __interrupt isr(void)
    ^
    ;
    2 errors generated.
    (908) exit status = 1
    nbproject/Makefile-default.mk:106: recipe for target 'build/default/production/_ext/1175247786/EC_L5_1b-Flash_LED-50p-1Hz.p1' failed
    make[2]: Leaving directory 'C:/Users/Bruce-HP/MPLABXProjects/XXX6.X'
    nbproject/Makefile-default.mk:90: recipe for target '.build-conf' failed
    make[1]: Leaving directory 'C:/Users/Bruce-HP/MPLABXProjects/XXX6.X'
    nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
    make[2]: *** [build/default/production/_ext/1175247786/EC_L5_1b-Flash_LED-50p-1Hz.p1] Error 1
    make[1]: *** [.build-conf] Error 2
    make: *** [.build-impl] Error 2
    BUILD FAILED (exit value 2, total time: 1s)
    #12
    ric
    Super Member
    • Total Posts : 28386
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: Interrupt error:variable has incomplete type void 2020/08/04 18:21:07 (permalink)
    +1 (1)
    You've merged together your source code and the last section of the build log into one block of text.
    Could you post just the entire build log please?
    The bit above does not show the lines that invoked the compiler.
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #13
    1and0
    Access is Denied
    • Total Posts : 11143
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: Interrupt error:variable has incomplete type void 2020/08/04 21:34:08 (permalink)
    +1 (1)
    nbrucew
    I could not get previous program to work and know I used C99 syntax 
     
     
    /***** INTERRUPT SERVICE ROUTINE *****/
    void __interrupt isr(void)
    {

    As I've said before, that __interrupt specifier is NOT C99.  Without () is C90 and with () is C99.
    #14
    1and0
    Access is Denied
    • Total Posts : 11143
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: Interrupt error:variable has incomplete type void 2020/08/04 21:35:25 (permalink)
    0
    ric
    I just compiled your exact source in both C90 and C99 mode, and it worked in both.

    I got the same results here.
    #15
    1and0
    Access is Denied
    • Total Posts : 11143
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: Interrupt error:variable has incomplete type void 2020/08/04 21:43:13 (permalink)
    +1 (1)
    nbrucew
    error: variable has incomplete type 'void'
     
    error: expected ';' after top level declarator

    Interesting that these two compiler error messages cannot be found in the XC8 Compiler User's Guide. 
    #16
    ric
    Super Member
    • Total Posts : 28386
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: Interrupt error:variable has incomplete type void 2020/08/04 21:47:38 (permalink)
    +1 (1)
    That's why I want to see the complete build log, to see WHICH compiler is actually being invoked.
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #17
    1and0
    Access is Denied
    • Total Posts : 11143
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: Interrupt error:variable has incomplete type void 2020/08/04 21:55:09 (permalink)
    0
    Compiling the code from Post #12 with XC8 v2.20 in C99 mode outputs this:
     
    CLEAN SUCCESSFUL (total time: 3ms)
    make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
    make[1]: Entering directory 'C:/TestXC8.X'
    make -f nbproject/Makefile-default.mk dist/default/production/TestXC8.X.production.hex
    make[2]: Entering directory 'C:/TestXC8.X'
    "C:\Program Files\Microchip\xc8\v2.20\bin\xc8-cc.exe" -mcpu=12F1501 -c -mdfp="C:/Program Files (x86)/Microchip/MPLABX/v5.40/packs/Microchip/PIC12-16F1xxx_DFP/1.2.63/xc8" -fno-short-double -fno-short-float -O2 -fasmfile -maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,-a -DXPRJ_default=default -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-osccal -mno-resetbits -mno-save-resetbits -mno-download -mno-stackcall -nodefaultlibs -std=c99 -gdwarf-3 -mstack=compiled:auto:auto -o build/default/production/_ext/1472/test.p1 ../test.c
    make[2]: *** [build/default/production/_ext/1472/test.p1] Error 1
    make[1]: *** [.build-conf] Error 2
    make: *** [.build-impl] Error 2
    ../test.c:79:6: error: variable has incomplete type 'void'
    void __interrupt isr(void)
         ^
    ../test.c:79:17: error: expected ';' after top level declarator
    void __interrupt isr(void)
                    ^
                    ;
    2 errors generated.
    (908) exit status = 1
    nbproject/Makefile-default.mk:107: recipe for target 'build/default/production/_ext/1472/test.p1' failed
    make[2]: Leaving directory 'C:/TestXC8.X'
    nbproject/Makefile-default.mk:91: recipe for target '.build-conf' failed
    make[1]: Leaving directory 'C:/TestXC8.X'
    nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
    BUILD FAILED (exit value 2, total time: 463ms)
    #18
    1and0
    Access is Denied
    • Total Posts : 11143
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: Interrupt error:variable has incomplete type void 2020/08/04 21:57:43 (permalink)
    0
    ... and build successful in C90 mode:
     
    CLEAN SUCCESSFUL (total time: 3ms)
    make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
    make[1]: Entering directory 'C:/TestXC8.X'
    make -f nbproject/Makefile-default.mk dist/default/production/TestXC8.X.production.hex
    make[2]: Entering directory 'C:/TestXC8.X'
    "C:\Program Files\Microchip\xc8\v2.20\bin\xc8-cc.exe" -mcpu=12F1501 -c -mdfp="C:/Program Files (x86)/Microchip/MPLABX/v5.40/packs/Microchip/PIC12-16F1xxx_DFP/1.2.63/xc8" -fno-short-double -fno-short-float -O2 -fasmfile -maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,-a -DXPRJ_default=default -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-osccal -mno-resetbits -mno-save-resetbits -mno-download -mno-stackcall -nodefaultlibs -std=c90 -gdwarf-3 -mstack=compiled:auto:auto -o build/default/production/_ext/1472/test.p1 ../test.c
    ../test.c:102:33: warning: (373) implicit signed to unsigned conversion
    "C:\Program Files\Microchip\xc8\v2.20\bin\xc8-cc.exe" -mcpu=12F1501 -Wl,-Map=dist/default/production/TestXC8.X.production.map -DXPRJ_default=default -Wl,--defsym=__MPLAB_BUILD=1 -mdfp="C:/Program Files (x86)/Microchip/MPLABX/v5.40/packs/Microchip/PIC12-16F1xxx_DFP/1.2.63/xc8" -fno-short-double -fno-short-float -O2 -fasmfile -maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,-a -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-osccal -mno-resetbits -mno-save-resetbits -mno-download -mno-stackcall -nodefaultlibs -std=c90 -gdwarf-3 -mstack=compiled:auto:auto -Wl,--memorysummary,dist/default/production/memoryfile.xml -o dist/default/production/TestXC8.X.production.elf build/default/production/_ext/1472/test.p1
    Non line specific message::: advisory: (1492) using updated 32-bit floating-point libraries; improved accuracy might increase code size
    Memory Summary:
    Program space used 33h ( 51) of 400h words ( 5.0%)
    Data space used 4h ( 4) of 40h bytes ( 6.2%)
    EEPROM space None available
    Configuration bits used 2h ( 2) of 2h words (100.0%)
    ID Location space used 0h ( 0) of 4h bytes ( 0.0%)
    make[2]: Leaving directory 'C:/Tests/TestXC8/TestXC8.X'
    make[1]: Leaving directory 'C:/Tests/TestXC8/TestXC8.X'
    BUILD SUCCESSFUL (total time: 1s)
    Loading code from C:/TestXC8.X/dist/default/production/TestXC8.X.production.hex...
    Program loaded with pack,PIC12-16F1xxx_DFP,1.2.63,Microchip
    Loading completed
     
     
    #19
    1and0
    Access is Denied
    • Total Posts : 11143
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: Interrupt error:variable has incomplete type void 2020/08/04 22:00:03 (permalink)
    +1 (1)
    Replace this
    void __interrupt isr(void)

    with this
    void __interrupt() isr(void)

    and it builds successfully in both C90 and C99 modes.
     
    #20
    Page: 12 > Showing page 1 of 2
    Jump to:
    © 2020 APG vNext Commercial Version 4.5