简体   繁体   English

AVR-GCC - 包含标头的枚举错误

[英]AVR-GCC - enum error with included header

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 我在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: 我将它包含在另一个头文件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: 和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 任何援助将不胜感激

Your headers buttons.h and debug_mode.h are including each other. 你的标题buttons.h和debug_mode.h是相互包含的。 You will need to refactor your code in such a way to remove this circular dependency. 您需要以这种方式重构代码以删除此循环依赖项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM