Multiple definitions

Posted by Greven on Sun 28 Nov 2004 08:37 AM — 3 posts, 13,779 views.

Canada #0
I'm a little tired, so this may be a stupid question. I am trying to add some code, and I am getting pages of this during linking:
o/imc.o(.bss+0x0): In function `imcstrlcpy(char*, char const*, unsigned)':
/home/mud/darkwars/dwadmins/src/imc.c:124: multiple definition of `imcwait'
imc.o(.bss+0x0):/home/mud/darkwars/dwadmins/src/imc.c:124: first defined here
o/imc.o(.bss+0x4): In function `imcstrlcpy(char*, char const*, unsigned)':
/home/mud/darkwars/dwadmins/src/imc.c:124: multiple definition of `imcconnect_attempts'
imc.o(.bss+0x4):/home/mud/darkwars/dwadmins/src/imc.c:124: first defined here
o/imc.o(.bss+0x8): In function `imcstrlcpy(char*, char const*, unsigned)':
/home/mud/darkwars/dwadmins/src/imc.c:124: multiple definition of `imc_sequencenumber'
imc.o(.bss+0x8):/home/mud/darkwars/dwadmins/src/imc.c:124: first defined here
o/imc.o(.data+0x0): In function `imcstrlcpy(char*, char const*, unsigned)':
/home/mud/darkwars/dwadmins/src/imc.c:124: multiple definition of `imcpacketdebug'
imc.o(.data+0x0):/home/mud/darkwars/dwadmins/src/imc.c:124: first defined here
I've checked all of the include files, making sure they have all the #ifdef __FILE__ in them, and they do. I'm positive this is something simple, but I'm just not thinking clearly. I'm sure that there are not multiple calls of every single function, as these are all included in the same .c file
Amended on Sun 28 Nov 2004 08:45 AM by Greven
USA #1
Given that the source lines of the first and second definitions are the same, I'd make sure you're not including imc.o twice in the linking phase or something like that.
Canada #2
Yeah, that was it. Thanks, too out of it to notice something simple like that. I was use
C_FILES = account.c act_comm.c act_html.c act_info.c act_move.c act_obj.c \
	  act_wiz.c alias.c arena.c autobuild.c backup.c ban.c \
	  boards.c bounty.c build.c changes.c channels.c clans.c cleanup.c color.c comm.c \
	  comments.c const.c db.c delivery.c designship.c dns.c editor.c \
	  fight.c finger.c handler.c hashstr.c homes.c hotboot.c immcomm.c \
	  implants.c installations.c interp.c magic.c makeobjs.c mccp.c \
	  medic.c misc.c msp.c mud_comm.c mud_prog.c mxp.c occupations.c \
	  olc-shuttle.c olc.c pfiles.c pilot.c player.c quest.c raceskills.c \
	  renumber.c reset.c restore.c save.c sharpen.c shell.c shops.c \
	  skills.c smuggling.c space.c space2.c special.c swskills.c \
	  tables.c track.c update.c vendor.c webroom.c web-server.c wedding.c

O_FILES = $(patsubst %.c,o/%.o,$(C_FILES))

H_FILES = $(wildcard *.h) 

ifdef IMC
   C_FILES := imc.c md5.c $(C_FILES)
   O_FILES := imc.o md5.o $(O_FILES)
endif


Thanks.