Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
09/17/07 07:32
Modified:
  09/17/07 08:05

Read: times


 
#144687 - undefined identifier
Responding to: ???'s previous message
Naing Linn said:
when i use "uint8_t i;"in my program .., it shows error like " uint8_t undefined identifier...any idea?

In the 'C' programming language, like most (all?) other High-Level Languages (HLLs), every 'identifier' must be defined before it can be used.

'Identifiers' are the names of program "objects"; eg,
  • A type name such as 'uint8_t' is an 'identifier';
  • A "variable" name is an 'identifier';
  • A function name is an 'identifier';
  • A label is an 'identifier';
  • etc, etc,...

    So, if the compiler tells you that something is "undefined", then the solution is to provide the appropriate definition!

    The first thing to check is the compiler Manual to see if the compiler itself provides a suitable definition.

    The types supportes by Keil C51 are listed here:
    http://www.keil.com/support/m...ctypes.htm

    Note that uint8_t is not part of the original ANSI 'C' standard - it (and the other platform-independent type definitions) was an extension added by the 1999 revision of the standard - commonly known as "C99".
    See, for example, http://www.netrino.com/Publications/Glossary/C.php

    Keil C51 comforms to the earlier 1989/1990 revisions of the standard - commonly known as "C89" and "C90"
    See: http://www.keil.com/support/docs/1893.htm
    and: http://www.keil.com/product/isoansi.asp

    Of course, you can easily build your own platform-independent type definitions using suitable typedefs and conditional compilation...

    eg, see: http://www.8052.com/forum/read.phtml?id=123891

    I use U8, S16, etc from force of habit, predating C99; as you're just starting, it would make sense for you to use the C99 names...


    Update:
    I couldn't find this earlier, but here's a thread with an extensive discussion on making a "portable" header file:
    http://www.8052.com/forum/read.phtml?id=116161

  • List of 99 messages in thread
    TopicAuthorDate
    8051 in C programming            01/01/70 00:00      
       Read the manual!            01/01/70 00:00      
          Not in Keil            01/01/70 00:00      
             an old IAR compiler            01/01/70 00:00      
                is there any fundamental problem...            01/01/70 00:00      
                   The C language            01/01/70 00:00      
                   structures            01/01/70 00:00      
                      A Non Standard Extension            01/01/70 00:00      
                         just don't use it            01/01/70 00:00      
                            Similar problem            01/01/70 00:00      
                               Time            01/01/70 00:00      
       Read The Manual (sometimes abbreviated to RTFM)!            01/01/70 00:00      
          silicon laboratories            01/01/70 00:00      
             Compiler?            01/01/70 00:00      
                no.            01/01/70 00:00      
                   actually            01/01/70 00:00      
             Aside: Keil            01/01/70 00:00      
             You are using Keil!            01/01/70 00:00      
                yes...            01/01/70 00:00      
                   Learn to walk first!            01/01/70 00:00      
                      FYP            01/01/70 00:00      
                         12 Weeks            01/01/70 00:00      
                in parts            01/01/70 00:00      
                   That's what I said            01/01/70 00:00      
                      (As) I Understand It (now) ;-)            01/01/70 00:00      
                      Misreading            01/01/70 00:00      
                         No problem :-)            01/01/70 00:00      
       the beauty of posting twice            01/01/70 00:00      
       error            01/01/70 00:00      
          include             01/01/70 00:00      
             probably best not to...            01/01/70 00:00      
                but why?            01/01/70 00:00      
                   Because            01/01/70 00:00      
          solved            01/01/70 00:00      
             Textbook time!            01/01/70 00:00      
          undefined identifier            01/01/70 00:00      
             typedefs of types for shorthand            01/01/70 00:00      
                Shorthand vs. Portability            01/01/70 00:00      
                   Plus            01/01/70 00:00      
                      Be careful            01/01/70 00:00      
                         The concise C spec            01/01/70 00:00      
                      Plus plus            01/01/70 00:00      
                   Another one - Certainty!            01/01/70 00:00      
                      then, define your stdstdint.h            01/01/70 00:00      
                      shorthand can be VERY useful            01/01/70 00:00      
       hi...back            01/01/70 00:00      
          RTFM!            01/01/70 00:00      
             Two books you need            01/01/70 00:00      
                no book in hand yet            01/01/70 00:00      
                   You need those books!            01/01/70 00:00      
                      :P            01/01/70 00:00      
                   meaning            01/01/70 00:00      
                      In glorious technicolor...            01/01/70 00:00      
                      Back to K&R            01/01/70 00:00      
                         ... but if you put it into the context of a...            01/01/70 00:00      
                         Cool Colors            01/01/70 00:00      
                            what about the other '51/mcu Cs?            01/01/70 00:00      
                         pedantic            01/01/70 00:00      
                            ya..            01/01/70 00:00      
       higher resolution ADC            01/01/70 00:00      
          ADC fundamentals            01/01/70 00:00      
             Hi-Res ADC is pointless with poor input circuitry!            01/01/70 00:00      
          4 bits!            01/01/70 00:00      
          Time for a new thread!            01/01/70 00:00      
       xdata            01/01/70 00:00      
          Re-post the code & fully describe the situation            01/01/70 00:00      
          Block Comment style            01/01/70 00:00      
             codes            01/01/70 00:00      
                Not quite            01/01/70 00:00      
                   no idea            01/01/70 00:00      
          analog input            01/01/70 00:00      
       how ?            01/01/70 00:00      
          Noob doc            01/01/70 00:00      
          there is no such thing            01/01/70 00:00      
             Already covered            01/01/70 00:00      
                Andy, I'm amazed            01/01/70 00:00      
       no            01/01/70 00:00      
          The link works            01/01/70 00:00      
             PDF Document            01/01/70 00:00      
       program added            01/01/70 00:00      
          I'm not sure what you're asking?            01/01/70 00:00      
             is it?            01/01/70 00:00      
                What??            01/01/70 00:00      
                   ok            01/01/70 00:00      
                      Post your code properly!            01/01/70 00:00      
                Why read twice?            01/01/70 00:00      
                   how?            01/01/70 00:00      
                      Accessing arrays            01/01/70 00:00      
                      some hints            01/01/70 00:00      
                         sfr16            01/01/70 00:00      
                            Did that            01/01/70 00:00      
                               re SFR16            01/01/70 00:00      
                               Naing Linn really needs to learn to do it himsel            01/01/70 00:00      
                               Thanks            01/01/70 00:00      
                      8 to 16 bit            01/01/70 00:00      

    Back to Subject List