1

I am a beginner in programming in C, and I am trying to make my code as modular as possible, so I want to declare a structure,

enum TRANSMITER_INT
{
    DISABLE,
    ENABLE
};
typedef struct Config
{
  enum TRANSMITER_INT TRANSMITER ;
}Config;

and initialize the values of this structure in a different header file, so the user will only have access to this file only to configure the module with it.

Config global_Config  =
     {   
          DISABLE  ,
     };

But when I Build the project it keeps giving me this error

expected '=', ',', ';', 'asm' or '__attribute__' before 'global_Config'

Any tips on how I can get this to work?

user207421
  • 305,947
  • 44
  • 307
  • 483
  • It seems like something is missing from this post, since you don't have anything here named `global_USART_Config`. I also don't see anything named `TRANSMITER_DISABLE`, so that's probably not going to work right either. – David Wohlferd Feb 14 '20 at 07:42
  • Is there anything else in the include file after the definition of the struct? If you declare a second struct but forget to put a ; at the end, you'd get an error just like this. And you do have the #include for your header file *before* you declare global_Config, right? – David Wohlferd Feb 14 '20 at 19:12

0 Answers0