我不断收到错误
make: *** No rule to make target `all'. Stop.
我确信我的 makefile 可以完美运行,因为我确实在终端上运行了它并且一切正常。但是当我尝试通过创建一个空的 Makefile 项目将所有内容导入 eclispe 时,我无法编译该程序。那么我错过了eclipse配置中的一些东西吗?
无论如何,这是我的makefile,请看一下,并纠正我。谢谢
CC = g++
prog: legrec.o game.o board.o piece.o
$(CC) legrec.o game.o board.o piece.o -Wall -Werror -pedantic -o legrec
legrec.o: legrec.cpp game.h
$(CC) -Wall -Werror -pedantic -c legrec.cpp
game.o: game.cpp game.h board.h piece.h move.h player.h
$(CC) -Wall -Werror -pedantic -c game.cpp
board.o: board.cpp board.h piece.h move.h player.h
$(CC) -Wall -Werror -pedantic -c board.cpp
piece.o: piece.cpp piece.h board.h move.h player.h
$(CC) -Wall -Werror -pedantic -c piece.cpp
编辑:感谢所有回复,我确实将第一行更改为 all:legrec,之前的错误消息消失了,但是又出现了另一个错误
cc legrec.o -o legrec
Undefined symbols for architecture x86_64:
"game::game()", referenced from:
_main in legrec.o
"game::printMenu()", referenced from:
_main in legrec.o
"game::printBoard()", referenced from:
_main in legrec.o
"game::nextMove()", referenced from:
_main in legrec.o
"game::ended()", referenced from:
_main in legrec.o
"game::printWinner()", referenced from:
_main in legrec.o
"game::~game()", referenced from:
_main in legrec.o
"std::terminate()", referenced from:
_main in legrec.o
"std::ios_base::Init::Init()", referenced from:
__static_initialization_and_destruction_0(int, int)in legrec.o
"std::ios_base::Init::~Init()", referenced from:
___tcf_0 in legrec.o
"___gxx_personality_v0", referenced from:
Dwarf Exception Unwind Info (__eh_frame) in legrec.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make: *** [legrec] Error 1
我只是不明白为什么运行相同的平台但程序执行不同。在我在终端上运行并在那里进行编辑之前,这看起来非常好,但是在移植到 Eclipse 之后,它让我对奇怪的错误感到疯狂。