View previous topic :: View next topic |
Author |
Message |
norman_tan
Joined: 30 Jan 2008 Posts: 27
|
Compiling Error131: Macro is defined recursively |
Posted: Tue Mar 13, 2018 1:48 am |
|
|
Hi All,
Has anybody ever met compiling Error131: Macro is defined recursively?
and how to solve this question if you met it before?
In my codes:
#define PBC_INT_DATA_ATTR
#define PBC_EXTERN_ATTR extern
or
#define PBC_EXTERN_ATTR
#define PBC_DATA pbc_data[handle].
//extern struct pbc_data PBC_INT_DATA_ATTR pbc_data[];
#else
#define PBC_DATA pbc_data.
//extern struct pbc_data PBC_INT_DATA_ATTR pbc_data;
#endif
and,
struct pbc_data
{
V1SL_SYS_PBC_DETAIL_PTR detail_ptr; /* detail-pointer of the related device */
V1SL_SYS_PTR_TYPE c0c1_sys_ptr; /* sys-pointer of the related device C0C1 */
V1SL_SYS_PTR_TYPE c2_sys_ptr; /* sys-pointer of the related device C2 */
V1SL_SYS_PATH_TYPE c0c1_sys_path; /* sys-path of related device C0C1 */
V1SL_SYS_PATH_TYPE c2_sys_path; /* sys-path of related device C2 */
...
}
Command line below will cause Error131 :"Micro is defined recursively" during compiling:
#ifdef V1SL_CFG_ENVIRONMENT_MULTI_DEVICE
PBC_EXTERN_ATTR struct pbc_data PBC_INT_DATA_ATTR pbc_data[PBC_DEVICE_NUMBER];
#else
PBC_EXTERN_ATTR struct pbc_data PBC_INT_DATA_ATTR pbc_data;
#endif
I do not know how to solve this error and ask help here.
Thanks a lot!
Norman |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19536
|
|
Posted: Tue Mar 13, 2018 4:19 am |
|
|
pbc_data == PBC_DATA......
Unless you turn strict typing on, CCS runs with case significance turned off. You have a define called PBC_DATA, and a variable called pbc_data. Result two different things using the same name.....
So this:
#define PBC_DATA pbc_data[handle]
Is trying to define something in terms of itself. Hence 'recursive'. |
|
|
norman_tan
Joined: 30 Jan 2008 Posts: 27
|
|
Posted: Wed Mar 14, 2018 12:29 am |
|
|
Hi Ttelmah,
CCS told me add command line "#case" at the start of the program will solve this problem!
I have tried it, CCS is right.
Thanks a lot! |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19536
|
|
Posted: Wed Mar 14, 2018 2:08 am |
|
|
as I said: "turn strict typing on".
#device ANSI also forces this. Which you need is dependant on what you actually want to do... |
|
|
|