If you don't export the symbols they have file scope, so the fact that you
link won't cause a complaint.
If by 'export' you mean 'give external linkage', you can't do that at
all for enum-values, or enum struct or union types or typedefs. They
don't even exist at link time in the usual separate-compilation model.
Only (some) objects (variables), and functions, have either internal
OR external linkage.
However usually you would want an enum in a
header. There you would get a clash if you included both.
If you want enums/types, or macros, shared across multiple translation
units, you have to put them in a (shared) header, or otherwise
duplicate the text (e.g. in your source-control system).
I'm not sure about 'usually' though. If the enum is part of the
interface to other modules, yes it belongs in .h. If it is only used
in the implementation, it's perfectly sensible in .c. IME (not
statistically valid) both occur, I would estimate about equally.
Unfortunately C
isn't clever enough to match up the enum symbol to the type of variable
holding it.
For enum-values, yes. For enum-types, sort of; in C (unlike C++) they
are only aliases for builtin integer types, but different enum types
MAY be different integer types, so the object type is affected by the
enum type. But many (most?) compilers don't bother and just use int.
And since most (symbolic) debuggers treat all symbols as global, or at
least all file-scope ones, even having the different enums in
different t.u.s, which is fine for compile and link, will cause chaos
in debugging -- if you use a debugger, which is a FArguedQ <G?>.