This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Error 231 with compiler version 6.14

I get the error 231 ("redefinition" of mib_type ) with the compiler version 6.14 when I'try to compile the flollowing code:

---Header File--------
#define u unsigned

typedef struct mib_data_st
{
u char x;
u char y

}mib_data_st;

extern code char **mib_type[8];
extern code mib_data_st mib_data[8];
---End of Header File---

---C-File---
code char *mib_type0="\x1""* 0 Hz *";
code char *mib_type1="\x1""* 1 Hz *";
code char *mib_type2="\x1""* 2 Hz *";
code char *mib_type3="\x1""* 3 Hz *";
code char *mib_type4="\x1""* 4 Hz *";
code char *mib_type5="\x1""* 5 Hz *";
code char *mib_type6="\x1""* 6 Hz *";
code char *mib_type7="\x1""* 7 Hz *";
code char *mib_type8="\x1""* 8 Hz *";

code char **mib_type[8+1]={
&mib_type0,
&mib_type1,
&mib_type2,
&mib_type3,
&mib_type4,
&mib_type5,
&mib_type6,
&mib_type7,
&mib_type8
};

---End of C-File---


This problem did not occur with the Version 6.10.

Has everyone any idea??

  • I don't know if everyone has an idea, but here is mine.

    Use

    typedef struct
    {
    u char x;
    u char y
    
    }mib_data_st;
    

    or
    typedef struct mib_data_st_tag
    {
    u char x;
    u char y
    
    }mib_data_st;
    

  • I'm surprised that v6.10 let you get away with it:

    ---Header File--------

    extern code char **mib_type[8];
    ---C-File---
    code char **mib_type[8+1]={

    In the header file, you have said "mib_type is an array of eight pointers to pointers to chars;"
    In the 'C' file, you have said "mib_type is an array of nine pointers to pointers to chars;"

    The Compiler is right to complain - you need to make up your mind what size you want the array to be! ;-)

    Note that it's not a bad idea to include your extern declarations in the same file as the actual definitions - it allows the compiler to catch errors like this!