I'm working on a smart meter project, ARM, keil compiler. I want to compile some of the more complex logic under g++ to run regression tests. I'm having a problem with some include files defining the interface to WMBus stack we purchased.
PACKED_STRUCT( typedef struct S_WMBUS_ADDR_T
{
/*! Manufacturer ID */
uint8_t pc_manufr[WMBUS_ADDR_MANUFR_LEN];
/*! Ident number */
uint8_t pc_ident[WMBUS_ADDR_IDENT_LEN];
/*! Version */
uint8_t c_version;
/*! Type */
uint8_t c_type;
}, s_wmbus_addr_t);
PACKED_STRUCT is defined in a compiler sensitive include file:
#elif defined (__GNUC__)
#define PACKED_STRUCT(__declaration__, __name__) \
__declaration__ __attribute__ ((__packed__)) __name__
...
#elif defined(__arm__)
#ifdef __ARMCC_VERSION
#define PACKED_STRUCT(__declaration__, __name__) \
__packed __declaration__ __name__
And I always get the following error messages:
error: types may not be defined in parameter types
error: typedef declaration invalid in parameter declaration
I can so no way around this other than by editing the include file to remove the PACKED_STRUCT. Obviously I won't edit the files directly, I'll copy them, edit them, and use the -I directive to make it find my modified files under G++
The error message seems to be saying you can declare a type as a parameter to a macro?
Note even if I redeclare:
#define PACKED_STRUCT(__declaration__, __name__) \
__declaration__ __name__
I am using the -std=c++11 flag to g++ but removing this flag solves nothing, but makes a system include fail
Is there any way I can define PACKED_STRUCT to make the unmodified code compile under g++?
Aucun commentaire:
Enregistrer un commentaire