0

使用 makefile 编译 C++ 程序时出现意外错误

我收到以下错误:

ishant@russell:~/CSD/cache$ make
make: Warning: File `makefile' has modification time 1.6e+03 s in the future
\g++ -o naivea.out naive.cpp mycache.cpp mylru.cpp myblock.cpp
/usr/lib/gcc/i486-linux-gnu/4.4.5/../../../../lib/crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
collect2: ld returned 1 exit status
make: *** [naive] Error 1

我的生成文件:

CC = \g++
CFLAGS = -W -Wall
COMMON = mycache.cpp mylru.cpp myblock.cpp
NAIVE = results/naive/
AWARE = results/aware/

all : naive aware 

naive : naive.cpp $(COMMON)
    $(CC) -o $(NAIVE)a.out $^

aware : cacheaware.cpp $(COMMON)
    $(CC) -o $(AWARE)a.out $^ -lm

mycache.cpp、mylru.cpp 和 myblock.cpp 分别定义了类缓存、lru 和块中的方法。虽然 cacheaware.cpp 和 naive.cpp 有矩阵乘法的代码和 main() 函数

4

0 回答 0