Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22162

odd linker error occuring when making program: 'multiple definition of `fnames'; src/main.o:(.data.rel.local+0x0): first defined here'

$
0
0

So I am programming a program that grew so much that I decided to create many files for this project (as I have done before). After creating 2 files and putting the appropriate functions in them these are the errors I get when make-ing.

/bin/ld: src/util.o:(.data.rel.local+0x0): multiple definition of `fnames'; src/main.o:(.data.rel.local+0x0): first defined here/bin/ld: src/util.o:(.data+0x0): multiple definition of `gBoard'; src/main.o:(.data+0x0): first defined here/bin/ld: src/possiblemoves.o:(.data.rel.local+0x0): multiple definition of `fnames'; src/main.o:(.data.rel.local+0x0): first defined here/bin/ld: src/possiblemoves.o:(.data+0x0): multiple definition of `gBoard'; src/main.o:(.data+0x0): first defined herecollect2: error: ld returned 1 exit statusmake: *** [Makefile:22: vgcp] Error 1

Here is my Makefile:

IDIR=/usr/include/SDL2CC=gccCFLAGS=-I$(IDIR)ODIR=srcLIBS=-lSDL2 -lSDL2_image_DEPS = main.hDEPS = $(patsubst %,$(IDIR)/%,$(_DEPS))_OBJ = main.o util.o possiblemoves.oOBJ = $(patsubst %,$(ODIR)/%,$(_OBJ))all: vgcp clean$(ODIR)/%.o: %.c $(DEPS)    $(CC) -c -o $@ $< $(CFLAGS)vgcp: $(OBJ)    $(CC) -o $@ $^ $(CFLAGS) $(LIBS).PHONY: cleanclean:    rm -f $(ODIR)/*.o

Viewing all articles
Browse latest Browse all 22162

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>