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

How to use extern sbit declare?

I declare a variable unsigned char bdata Kde in a.c.

[in file a.c]

unsigned char bdata Kde;

Than I want to use the variable inb.c.
[in file b.c]
#include <stdio.h>
.....
extern unsigned char bdata Kde;
sbit testbit=Kde^1;
void main(void)
{......}

:error C141:.......a.c:syntax error near 'sbit'

why?

Parents
  • "I'm still puzzling as to why I would want this."

    I think that was Jon's point - just because you can do something doesn't make it a Good Thing!

    As I said, you need to look at the preprocessor listing to see the text which the Compiler actually receives; the Compiler can't possibly give warnings about the input to the preprocessor, because it never sees that!

    Perhaps you need to start using lint, or similar?

Reply
  • "I'm still puzzling as to why I would want this."

    I think that was Jon's point - just because you can do something doesn't make it a Good Thing!

    As I said, you need to look at the preprocessor listing to see the text which the Compiler actually receives; the Compiler can't possibly give warnings about the input to the preprocessor, because it never sees that!

    Perhaps you need to start using lint, or similar?

Children