[OT] Linker Problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Big List of Linux Books]     [Fedora Users]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux