저는 makefile을 처음 사용합니다. 나는 왜 컴파일 된 후에 실행 파일 'main'이 나타나지 않는지 잘 모르겠다. 코드는 잘 컴파일하지만 컴파일러는 말한다 : 아래 Makefile- 실행 파일을 출력하지 않습니다.
-lm: linker input file unused because linking not done
-ltiff: linker input file unused because linking not done
는 메이크 코드 :
main.o: main.c file_io.h nmsimplex.h corr.h
$(CC) $(CFLAGS) -o [email protected] -fopenmp $< $(LDFLAGS)
당신에게 :
INCLUDES = -I. -I../include -I/opt/local/include
CC = gcc
OBJS = image_io.o textfile_io.o main.o
CFLAGS = $(INCLUDES) -c -g
DESTDIR = ../bin
LDFLAGS = -L. -L../lib -L/opt/local/lib -lm
DEPS = file_io.h corr.h nmsimplex.h matrix.h /opt/local/include/tiffio.h \
/opt/local/include/tiff.h
image_io.o: image_io.c file_io.h /opt/local/include/tiffio.h \
/opt/local/include/tiff.h
$(CC) $(CFLAGS) -o [email protected] $< $(LDFLAGS) -ltiff
textfile_io.o: textfile_io.c file_io.h
$(CC) $(CFLAGS) -o [email protected] $< $(LDFLAGS)
main.o: main.c file_io.h nmsimplex.h corr.h
$(CC) $(CFLAGS) -o [email protected] -fopenmp $< $(LDFLAGS)
main: $(OBJS)
$(CC) -o $(DESTDIR)/[email protected] -fopenmp $^ $(LDFLAGS)
.PHONY: clean
clean:
rm -f *.o *~
감사합니다 당신이 두 개의 경고를받을 이유
링크하지 않을 때 링커 플래그를 포함시키는 이유는 무엇입니까? –
나는 할 수 없었습니다. –
네 말이 맞아. 나는이 용어에 조금 새로운 것이었다. 하지만 고마워요. – nineties