cancel
Showing results for 
Search instead for 
Did you mean: 

Has already been declared in current scope : ERROR

kunal5959
Associate II
Posted on February 08, 2013 at 14:22

In pal.h

{...............

................

.............

typedef enum   {

    PAL_IOLSTATE_NOREQUEST,

    PAL_IOLSTATE_ACTIVE_REQUEST,

    PAL_IOLSTATE_APP_ACTIVE

} pal_RequestState_t;

extern pal_RequestState_t pal_eRequestState ;

..........

............

;}

in main.c

{

#include ''pal.h''

#include ''stm32f10x_conf.h''

#include ''datatypes.h''

#include <stdlib.h>

code........

...........

............

............

pal_RequestState_t  pal_eRequestState = PAL_IOLSTATE_NOREQUEST;

}

In one of my codes written IAR workbench C++ IDE for microcontroller STM32F100, after compiling i am getting a syntax error as:----

Error[Pe256]: invalid redeclaration of type name ''pal_RequestState_t'' 

Error[Pe101]: ''PAL_IOLSTATE_NOREQUEST'' has already been declared in the current scope 

Error[Pe101]: ''PAL_IOLSTATE_ACTIVE_REQUEST'' has already been declared in the current scope (at line 487) 

Error[Pe101]: ''PAL_IOLSTATE_APP_ACTIVE'' has already been declared in the current 

I am not able to figure out the error as there exists no other instance where i have declared these enum variables. I wonder if it is related to compiler settings.Please excuse me if i have insufficient information here as i af just shown a part of the code which needs to be verified.

Can anyone help me  with this error???

1 REPLY 1
Posted on February 08, 2013 at 15:13

Perhaps you've included the file multiple time, not sure the variable is ''extern'' in the context you define.

You could address the repeat inclusion of pal.h with the usual #ifdef PAL_H / #define PAL_H type construct.

You could review the line(s) the error is flagging for current and prior definitions.

You could use ''Find in File'' or other browsing options.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..