C Makefile file error: "gcc: -lm: link-input file is not used because the link was not made mpicc -lm 3D-ELM.o -o 3D-ELM.exe"

I'm having problems with the C Makefile.

Here are the contents of the Makefile:

PROJECT = 3D-ELM
MPICC = mpicc
CLAGS = -g -O3
LIBS = -lm
SRC = src_el
OBJECTS = $(PROJECT).o

$(PROJECT).exe : $(OBJECTS)
        $(MPICC) $(CFLAGS) $(LIBS) $(OBJECTS) -o $(PROJECT).exe

$(PROJECT).o : $(SRC)/$(PROJECT).c
        $(MPICC) $(CFLAGS) $(LIBS) -c $(SRC)/$(PROJECT).c

clean:
        rm -rf *o $(PROJECT)

When I do, here is the error:

gcc: -lm: linker input file not used because link failed

Does anyone know what is wrong?

Thank you very much in advance,


EDITOR: Got it. I do not need to transfer libraries when creating an object file ... Doh! head bangs at the table

Thanks for your help guys

+5
source share
1 answer

The problem arises from this part of the makefile:

$(PROJECT).o : $(SRC)/$(PROJECT).c
        $(MPICC) $(CFLAGS) $(LIBS) -c $(SRC)/$(PROJECT).c

. -c , . , $(LIBS) .

:

$(PROJECT).exe : $(OBJECTS)
        $(MPICC) $(CFLAGS) $(LIBS) $(OBJECTS) -o $(PROJECT).exe

. , .

+7

All Articles