Linking error: undefined symbol

Comments

2 comments

  • Avatar
    Jon Elliott

    You need to put an "unsigned char Flag1;" in one of your C files in order to define the variable.

    Adding "extern" just declares the variable it does not define it.

    If you put the definition in your header file and include that header file from multiple C files the variable will be defined in each of those C files, hence the duplicate symbol error.

     

    0
    Comment actions Permalink
  • Avatar
    Alex Birman

    Thank you.

    A short reading of the following article also helped me to understand the difference between declaring and defining:

    http://www.edaboard.com/thread124112.html

    0
    Comment actions Permalink

Please sign in to leave a comment.