Path: chuka.playstation.co.uk!scea!peter_alau@playstation.sony.com From: "Antony Arciuolo" Newsgroups: scea.yaroze.programming.gnu_compiler Subject: Linking Date: Thu, 2 Dec 1999 20:26:11 -0500 Organization: SCEA News Server Lines: 59 Message-ID: <8275bv$jq3@scea> NNTP-Posting-Host: s14.slot0.dial1.hnj.nac.net X-Newsreader: Microsoft Outlook Express 4.72.3155.0 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3155.0 I have an array to describe a layout (index) for a GsBG. I want to explicitly define it in the header of a BG module: #ifndef BG_H #define BG_H u_short Layout1[] = { GsCELLtransparentCell, GsCELLtransparentCell, GsCELLtransparentCell, GsCELLtransparentCell, GsCELLtransparentCell, GsCELLtransparentCell }; ... #endif Now I want to compile using this makefile PROGRAM = test.pxe PXE_ADDR = 80140000 # To Optimize use -O3 instead of -g OPTIONS = -c -g LINKER = -Xlinker -Map -Xlinker mapfile.map -Xlinker -Ttext -Xlinker $(PXE_ADDR) DEPENDENCIES = bg.o main.o all: $(PROGRAM) $(PROGRAM): $(PROGOBJ) $(DEPENDENCIES) gcc $(LINKER) $(DEPENDENCIES) -o $(PROGRAM) main.o: main.c mainTIMS.h Levels.h gcc $(OPTIONS) main.c bg.o: bg.c bg.h Levels.h gcc $(OPTIONS) bg.c The problem is: gcc -Xlinker -Map -Xlinker mapfile.map -Xlinker -Ttext -Xlinker 80140000 bg.o main.o -o test.pxe main.o(.data+0x0): multiple definition of `Layout1' bg.o(.data+0x0): first defined here make.exe: *** [test.pxe] Error 1 How can I solve this? It just does not seem to me that it is being defined twice, and if I redeclare Layout1 as: u_short Layout1[6]; Everything is fine. Why? - Tony