[vdr] [OT] Linker Problem

Udo Richter udo_richter at gmx.de
Mon Jan 9 14:42:36 CET 2006


CopyPoint wrote:
> Hi all,
> after splitting my autosort.c into several [hc]-files i ran into trouble
> with ld.
> can anybody give me a hint how to solve this??
> 
> autogroup.o(.bss+0x0):../../../include/vdr/tools.h:217: multiple
> definition of `AutoGroups'
> autosort.o(.bss+0x0):/home/video/vdr-1.3.32-soft/PLUGINS/src/autosort-0.1.0/autosort.c:34:
> first defined here

well... you can have only one (exported, non-static) AutoGroups variable
across all modules, just as the error says. Currently, autogroup.o and
autosort.o export a symbol named 'AutoGroups', and the linker doesn't
know which one to prefer. Hard to guess whats wrong without seeing the code.

My guess, you've copied the declaration
  cAutoGroups AutoGroups;
into the header file. If you want to declare global variables in a
header file, you have to declare
  extern cAutoGroups AutoGroups;
in the .h file (for import and forward declaration) and another
  cAutoGroups AutoGroups;
in the .c file (the actual declaration).

Cheers,

Udo



More information about the vdr mailing list