Hi i am on a logging system and want to make a struct that holds the internal state of my logger:
#include "logger.h"
#include "main.h"
/*
* Variables
*/
/*State of Logging*/
struct {
bool logOn;
static enum eLogLevel outputLevel[7];
} sLogStruct;
static struct sLogStruct gLogData;
void Log(enum eLogSubSystem sys, enum eLogLevel level, char * msg)
{
}
I defined the eLogLevel enumeration in the logger.h file:
#ifndef LOGGER_H_
#define LOGGER_H_
#include "globaldefinitions.h"
/*
* Logger data types
*/
typedef enum eLogLevel {none, information_only, debugging, warning, error, critical};
typedef enum eLogSubSystem {coresystem, heartrate, temperature, accelerometer, communication, flash, firmwareUpdate};
/*
* Public functions
*/
void Log(enum eLogSubSystem sys, enum eLogLevel level, char * msg);
void LogWithNum(enum eLogSubSystem sys, enum eLogLevel level, char * msg, int number);
void LogSetOutputLevel(enum eLogSubSystem sys, enum eLogLevel level);
void LogGlobalOn(void);
void LogGlobalOff(void);
void LogVersion (em_fw_version_t version);
#endif /* LOGGER_H_ */
However, my compiler complains that:
../Logging/logger.c:18:2: error: expected specifier-qualifier-list before 'static'
static enum eLogLevel outputLevel[7];
I cant figure out how to solve this, i guess its trivial, but i dont know why it doesnt accept my typedef enum eLogLevel from the logger.h file. Can you please help me understand?