?
=?ISO-8859-1?Q?Jens_M=FCller?=
I have a file here with several enums:
#ifndef PLANARSEP_OPTIMIZE_H
#define PLANARSEP_OPTIMIZE_H
enum fund_cycle_behavior_t
{PASS_MODE_FIRST,
PASS_MODE_BEST,
PASS_MODE_ALL};
enum optimization_criterium_t
{OPTIMIZE_NOTHING,
OPTIMIZE_SEPARATOR,
OPTIMIZE_BALANCE,
OPTIMIZE_RATIO};
enum end_opt_t
{END_OPTIMIZE_NOTHING,
END_OPTIMIZE_EXPEL,
END_OPTIMIZE_DUL_MEN,
END_OPTIMIZE_EXPEL_DUL_MEN,
END_OPTIMIZE_DUL_MEN_EXPEL};
#endif
Before, the enums didn't have a name and everything worked.
Now that I included the names (in order to store the values in variables
having the enum type), I get the following error when linking:
Link separator
libseparator_time.a(g_planar_separator_time.o).bss+0x0): multiple
definition of `fund_cycle_behavior_t'
libseparator_time.a(PlanarSeparator_time.o).bss+0x0): first defined here
libseparator_time.a(g_planar_separator_time.o).bss+0x4): multiple
definition of `optimization_criterium_t'
libseparator_time.a(PlanarSeparator_time.o).bss+0x4): first defined here
libseparator_time.a(g_planar_separator_time.o).bss+0x8): multiple
definition of `end_opt_t'
libseparator_time.a(PlanarSeparator_time.o).bss+0x8): first defined here
libseparator_time.a(complex_separation_time.o).bss+0x0): multiple
definition of `fund_cycle_behavior_t'
libseparator_time.a(PlanarSeparator_time.o).bss+0x0): first defined here
libseparator_time.a(complex_separation_time.o).bss+0x4): multiple
definition of `optimization_criterium_t'
libseparator_time.a(PlanarSeparator_time.o).bss+0x4): first defined here
libseparator_time.a(complex_separation_time.o).bss+0x8): multiple
definition of `end_opt_t'
libseparator_time.a(PlanarSeparator_time.o).bss+0x8): first defined here
collect2: ld returned 1 exit status
I haven't changed any other code yet ...
Can't I declare an enum in a header file included in multiple
compilation units?
#ifndef PLANARSEP_OPTIMIZE_H
#define PLANARSEP_OPTIMIZE_H
enum fund_cycle_behavior_t
{PASS_MODE_FIRST,
PASS_MODE_BEST,
PASS_MODE_ALL};
enum optimization_criterium_t
{OPTIMIZE_NOTHING,
OPTIMIZE_SEPARATOR,
OPTIMIZE_BALANCE,
OPTIMIZE_RATIO};
enum end_opt_t
{END_OPTIMIZE_NOTHING,
END_OPTIMIZE_EXPEL,
END_OPTIMIZE_DUL_MEN,
END_OPTIMIZE_EXPEL_DUL_MEN,
END_OPTIMIZE_DUL_MEN_EXPEL};
#endif
Before, the enums didn't have a name and everything worked.
Now that I included the names (in order to store the values in variables
having the enum type), I get the following error when linking:
Link separator
libseparator_time.a(g_planar_separator_time.o).bss+0x0): multiple
definition of `fund_cycle_behavior_t'
libseparator_time.a(PlanarSeparator_time.o).bss+0x0): first defined here
libseparator_time.a(g_planar_separator_time.o).bss+0x4): multiple
definition of `optimization_criterium_t'
libseparator_time.a(PlanarSeparator_time.o).bss+0x4): first defined here
libseparator_time.a(g_planar_separator_time.o).bss+0x8): multiple
definition of `end_opt_t'
libseparator_time.a(PlanarSeparator_time.o).bss+0x8): first defined here
libseparator_time.a(complex_separation_time.o).bss+0x0): multiple
definition of `fund_cycle_behavior_t'
libseparator_time.a(PlanarSeparator_time.o).bss+0x0): first defined here
libseparator_time.a(complex_separation_time.o).bss+0x4): multiple
definition of `optimization_criterium_t'
libseparator_time.a(PlanarSeparator_time.o).bss+0x4): first defined here
libseparator_time.a(complex_separation_time.o).bss+0x8): multiple
definition of `end_opt_t'
libseparator_time.a(PlanarSeparator_time.o).bss+0x8): first defined here
collect2: ld returned 1 exit status
I haven't changed any other code yet ...
Can't I declare an enum in a header file included in multiple
compilation units?