Typedef enum not seen by all .c files? How to creat macro

Discussion in 'Programmer's Corner' started by danielb33, Jul 5, 2013.

  1. danielb33

    Thread Starter Member

    Aug 20, 2012
    105
    0
    I often need to use a var.h file for some global variables for interrupt driven code. I am just starting to write large enough programs to where typedef enums, structures and unions will help the code be much more readable.

    When I place a typedef enum in my header files, I get multiple definitions errors when including that header in multiple .c files. Is there an extern reference of sort for typedef? Or does anyone know how to make the typedef be seen by all or multiple files?

    Thanks much.
     
  2. danielb33

    Thread Starter Member

    Aug 20, 2012
    105
    0
    Never mind...stupid mistake. Was actually assigning a value to the typedef in the .h file.
     
  3. WBahn

    Moderator

    Mar 31, 2012
    17,748
    4,796
    Glad you found it. For future reference, it really helps if you post the code snippet that is causing the problem. If you hadn't found your mistake, then someone here probably would have spotted it right away, whereas from just a verbal description it would have been very hard to guess that that was the problem.
     
Loading...