Christy Wald Christy Wald - 17 days ago 7
C Question

Parse error in C code (.h file)

I am trying to integrate a C code. While building the stack I get parse error from all the files, where I have included this .h file

#if( FLS_CANCEL_API == STD_ON ) // Parse error appears here
extern FUNC( void, FLS_CODE ) Fls_Cancel( void );
#endif /* FLS_CANCEL_API == STD_ON */

#if( FLS_GET_STATUS_API == STD_ON ) // and here
extern FUNC( MemIf_StatusType, FLS_CODE ) Fls_GetStatus( void );
#endif /* FLS_GET_STATUS_API == STD_ON */


Edit



Macros are defined in another header file

#define FLS_CANCEL_API [!IF "FlsGeneral/FlsCancelApi"!](STD_ON)[!ELSE!](STD_OFF)[!ENDIF!]


and

#define STD_ON 0x01

Answer

This is code for some drivers written according to the Autosar standard, in the automotive industry. The header file that has:

#define FLS_CANCEL_API              [!IF "FlsGeneral/FlsCancelApi"!](STD_ON)[!ELSE!](STD_OFF)[!ENDIF!]

is in fact not a header file, it's a template of a header file. A tool takes an Autosar ECU description and those templates to produce actual code. I think your file is the template for Fls_Cfg.h, and so the actual Fls_Cfg.h would be generated from that template. I'm not entirely sure based on the template but I think it's intended for the EB tresos Studio tool.

So you need to use that tool, or if you have no tools, you need to explain in more detail what you're trying to do and why.

Comments