1

这是生成文件:

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

为什么忽略输入和输出???

4

2 回答 2

4

您还没有定义变量inputoutput任何地方。电脑不是能猜出你意图的魔法盒子。

于 2013-01-24T22:38:39.353 回答
3

您的 .cpp -> .o 隐式规则不正确:

%.o: %.cpp
        $(CC) -c $(CC_FLAGS) $< -o $@
  • $<设置make为源文件
  • $@将是输出文件名
于 2013-01-24T22:40:12.957 回答