Thursday 15 March 2012

c - AVR-GCC - enum error with included header -


I know I'm making a mistake and I'm having trouble finding out how I can not solve it. I get the following error:

  Buttons from buttons are included in h: 8, buttons.c from: 1: debug_mode.h: 14: error: expected ')' first 'button '  

I have an enum declared in the buttons.

  #ifndef BUTTONS_HEADER #define BUTTONS_HEADER #include & lt; Avr / io.h & gt; # Include & lt; Stdbool.h & gt; # Include & lt; Use / delay.h & gt; #include "uart.h" #include "debug_mode.h" typed enum {NO_BUTTON, BUTTON1, BUTTON2, BUTTON3, BUTTON4, BUTTON5, BUTTON6} buttonFlag; Zero checkbacks (); Zero SetButtonFlag (); Zero processbutton (); #endif   

I am including a header debug_mode.h:

  #ifndef DEBUG_MODE_HEADER #define DEBUG_MODE_HEADER #include "uart.h" #included Are & lt; Stdbool.h & gt; # Include & lt; Avr / pgmspace.h & gt; #include "buttons.h" bool DebugModeEnabled = false; Zero SetDebugMode (); Zero Declaration Debug (Boul State); Zero debuggerone onset from the set (); Zero debuggingbuttonstate (buttonflag button); #endif   

and debug_mode.c:

  #include "debug_mode.h" Zero DebugAnnounceButtonState (ButtonFlags Button) {SendUARTString_P (DEBUGMODE_BUTTON_PRESSED_MSG); Switch (Button) {Case 1: SendUARTString_P (DEBUGMODE_BUTTON1_MSG); break; Default: Break; }}   

Any help would be appreciated

Header buttons. H and debug_mode.h are included each other. You will need to refactor your code in this way to overcome this circular dependency.

No comments:

Post a Comment