Reputation: 335
I am having trouble spotting where I am making a mistake and not sure how to google the solution. I am getting the following error:
In file included from buttons.h:8,
from buttons.c:1:
debug_mode.h:14: error: expected ')' before 'Button'
I have an enum declared in buttons.h
#ifndef BUTTONS_HEADER
#define BUTTONS_HEADER
#include <avr/io.h>
#include <stdbool.h>
#include <util/delay.h>
#include "uart.h"
#include "debug_mode.h"
typedef enum {
NO_BUTTON,
BUTTON1,
BUTTON2,
BUTTON3,
BUTTON4,
BUTTON5,
BUTTON6
}
ButtonFlags;
void CheckButtons();
void SetButtonFlag();
void ProcessButtons();
#endif
I am including it in another header debug_mode.h:
#ifndef DEBUG_MODE_HEADER
#define DEBUG_MODE_HEADER
#include "uart.h"
#include <stdbool.h>
#include <avr/pgmspace.h>
#include "buttons.h"
bool DebugModeEnabled = false;
void SetDebugMode();
void AnnounceDebugMode(bool State);
void DebugAnnounceLEDState();
void DebugAnnounceButtonState(ButtonFlags Button);
#endif
and the debug_mode.c:
#include "debug_mode.h"
void DebugAnnounceButtonState(ButtonFlags Button)
{
SendUARTString_P(DEBUGMODE_BUTTON_PRESSED_MSG);
switch (Button)
{
case 1: SendUARTString_P(DEBUGMODE_BUTTON1_MSG); break;
default: break;
}
}
Any assistance would be appreciated
Upvotes: 0
Views: 712
Reputation: 793
Your headers buttons.h and debug_mode.h are including each other. You will need to refactor your code in such a way to remove this circular dependency.
Upvotes: 2