0
我試圖讓從模板生成文件,這就是我的了:GCC生成文件與-Wall -pedantic和-lpthread
CFLAGS = -Wall -pedantic
LFLAGS = -lpthread
CC = gcc
OBJS = bank5.o client2.o
PROGRAM = ex2
all: bank client
ex2: $(OBJS)
$(CC) $(LFLAGS) $(OBJS) -o $(PROGRAM)
bank: bank5.c
$(CC) $(CFLAGS) -c bank5.c receive_message.c send_message.c -o bank5
client: client2.c
$(CC) $(CFLAGS) -c client2.c receive_message.c send_message.c -o client2
當我嘗試運行它,我得到這個錯誤:
gcc -Wall -pedantic -c bank5.c receive_message.c send_message.c -o bank5
gcc: fatal error: cannot specify -o with -c, -S or -E with multiple files
compilation terminated.
make: *** [bank] Error 4
這是我的makefile文件看起來像-Wall -pedantic和之前,這通常跑:
all: bank client
bank: bank5.c
gcc bank5.c receive_message.c send_message.c -o bank5 -lpthread
client: client2.c
gcc -o client2 client2.c send_message.c receive_message.c
就像我說的,我是從一個模板來做的,模板有這些。 – Mari