这是makefile:
CC=g++
CC_FLAGS=-Wall -march=native -ffast-math -O3
CC_SOURCES=AbsNode.cpp rle16.cpp
CC_OBJECTS=AbsNode.o rle16.o
# Link command:
test : $(CC_OBJECTS)
$(CC) $(CC_OBJECTS) -o test
# Compilation commands:
%.o:%.cpp
$(CC) -c $(CC_FLAGS) $(input) -o $(output)
将make应用于此makefile时,我得到以下输出:
g++ -c -Wall -march=native -ffast-math -O3 -o
g++: arguemnt to '-o' missing
为什么输入和输出被忽略?
答案 0 :(得分:4)
您尚未在任何地方定义变量input
和output
。计算机不是一个可以猜出你的意图的魔术盒。
答案 1 :(得分:3)
你的.cpp - > .o隐式规则不正确:
%.o: %.cpp
$(CC) -c $(CC_FLAGS) $< -o $@
$<
由make
设置为源文件$@
将是输出文件名