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

C231 Redefinition with xdata

Hello,

I'm using the C51 compiler for a C8051F043 target. I'm allocating a variable array with the statement:

unsigned char xdata gbuf[2048];

When I compile, I get an Error C231, redefinition of gbuf. The problem is, it's not defined elsewhere in code. To make sure I commented out this statement, and sure enough, I get a linker error because it can't find gbuf. Has someone got an idea of what my problem may be?

Thanks, Brian Warren

Parents
  • Oh yes it should!

    I don't think so. Not with the variable declared "extern", like the OP said it was. It's perfectly allowed to declare the same variable 'extern' a thousand times, as long as you don't also give it an initializer.

    Which brings it back to actual differences between the extern declaration in the header, and the definition in the source which the OP showed us.

Reply
  • Oh yes it should!

    I don't think so. Not with the variable declared "extern", like the OP said it was. It's perfectly allowed to declare the same variable 'extern' a thousand times, as long as you don't also give it an initializer.

    Which brings it back to actual differences between the extern declaration in the header, and the definition in the source which the OP showed us.

Children