Re: enum variables and extern



Charlie wrote:

I have a file, data.c, where I define all of my global variables.

I then have a header file, data.h, which I include in every file in
which I reference all of the variables defined in data.c.

For the most part, I am having no problem with this. However, I
defined an variable of type myenum in data.c:

enum myenum
{
Mon,
Tues,
Wed
} enum_var;

Now when I try to reference enum_var in data.h, the compiler gives me
issues. I have tried multiple ways of referencing it and defining it,
but nothing is working. I guess I just don't understand something
about enum types and/or extern.

We did this last week (or was it the week before). Have a look in the
archives.

Briefly: you have to declare your enum type in your data.h file.

It worries me that you have so many global variables you have "all"
of them, and all in one place too.

--
"How am I to understand if you won't teach me?" - Trippa, /Falling/

Hewlett-Packard Limited registered no:
registered office: Cain Road, Bracknell, Berks RG12 1HN 690597 England

.



Relevant Pages

  • enum variables and extern
    ... I then have a header file, data.h, which I include in every file in ... defined an variable of type myenum in data.c: ... Now when I try to reference enum_var in data.h, ...
    (comp.lang.c)
  • Re: .NET type in Web Service Proxy class
    ... >> If I create a web service with web methods containing enum types these ... >> are automatically created in the proxy class when I add a web reference to ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: enum variables and extern
    ... I then have a header file, data.h, which I include in every file in ... defined an variable of type myenum in data.c: ... Now when I try to reference enum_var in data.h, ... enum myenum; ...
    (comp.lang.c)
  • Re: extern and enum typed variables
    ... I define an enum and variable of that type in data.c, ... When I try to reference the variable, enum_var, in data.h the compiler ... It's OK to define typedefs and enum types in a header file. ...
    (comp.lang.c)
  • Re: enum variables and extern
    ... I then have a header file, data.h, which I include in every file ... in which I reference all of the variables defined in data.c. ... along with an extrn reference for an object: ... extrn enum myenum enum_var; ...
    (comp.lang.c)