未定义的主要参考

时间:2013-07-02 06:44:10

标签: c++ makefile

使用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

我的makefile:

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分别对类cache,lru和block中的方法有定义。虽然cacheaware.cpp和naive.cpp具有矩阵乘法代码以及main()函数

0 个答案:

没有答案