Hello I need to create a makefile for 2 separated cpp programs that are in one directory. I have got this code, but it's not working correctly. The .o files do not get created.Thank you
OBJS = a b
EXEC = first_run second_run
#------ constant definitions
ALL_OBJ = $(OBJS:%=%.o)
all: $(EXEC)
clean:
$(RM) $(EXEC) $(OBJS) $(ALL_OBJ); make all
CC = g++
DO_OBJS = $(CC) -cpp -o [email protected] [email protected]; touch $@
DO_EXEC = $(CC) -s -o $@ $(ALL_OBJ)
#------ now compile
$(OBJS): $(@:%=%.o)
$(DO_OBJS)
$(EXEC): $(OBJS)
$(DO_EXEC)
_start': (.text+0x0): multiple definition of_start' /usr/lib/gcc/i686-linux-gnu/4.6/../../../i386-linux-gnu/crt1.o:(.text+0x0): first defined here a.o:(.rodata+0x0): multiple definition of_fp_hw' /usr/lib/gcc/i686-linux-gnu/4.6/../../../i386-linux-gnu/crt1.o:(.rodata+0x0): first defined here a.o: In function_fini': (.fini+0x0): multiple definition of `_fini' /usr/lib/gcc/i686-linux-gnu/4.6/../../../i386-linux-gnu/crti.o:(.fini+0x0): first defined herea&brelate tofirst_runandsecond_run? Is your first program supposed to be an executable calledfirst_run? Or an executable calleda? Or what?a.oandb.o? You don't want to create an executable?