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
  • "This may also explain the penchant of C programmers to remove uppercase from everything else, including URLs: fear of the preprocessor!"

    Actually, it's more likely to be those with a UNIX background - but then 'C' and UNIX are very closely linked!

    However, some parts of the internet (including some webservers) are case-sensitive (probably mostly the UNIX bits!) - so it's not always safe to fiddle with the capitalisation of a URL, E-Mail address, etc

    "I suppose that this means to use uppercase for the #defines"

    Yes, that is the convention.

    Preprocessor definitions can behave quite differently to 'C' symbols - especially concerning side-effects etc - therefore it is particularly valuable to have your Preprocessor definitions instantly distinguishable, to help avoid the common pitfalls (see any good 'C' book)

Reply
  • "This may also explain the penchant of C programmers to remove uppercase from everything else, including URLs: fear of the preprocessor!"

    Actually, it's more likely to be those with a UNIX background - but then 'C' and UNIX are very closely linked!

    However, some parts of the internet (including some webservers) are case-sensitive (probably mostly the UNIX bits!) - so it's not always safe to fiddle with the capitalisation of a URL, E-Mail address, etc

    "I suppose that this means to use uppercase for the #defines"

    Yes, that is the convention.

    Preprocessor definitions can behave quite differently to 'C' symbols - especially concerning side-effects etc - therefore it is particularly valuable to have your Preprocessor definitions instantly distinguishable, to help avoid the common pitfalls (see any good 'C' book)

Children
No data