【发布时间】:2018-05-19 02:42:17
【问题描述】:
生成文件
# Assignments
#########################################################
CC := g++
SRC := src
BUILD := build
INCLUDE := include
TARGET := bin/driver
LIB := lib
TESTS := tests
CFLAGS := -g -Wall -Wextra
PATH := -I $(INCLUDE)
#########################################################
driver: Logbook.o Entry.o main.o
g++ Logbook.o Entry.o main.o -o driver
main.o: main.cpp
g++ -c main.cpp
Logbook.o:
g++ -c $(PATH) $(LIB)/Logbook.cpp
Entry.o:
g++ -c $(PATH) $(LIB)/Entry.cpp
test:
g++ -c $(PATH) $(LIB)/Logbook.cpp
clean:
rm -f *.o *.exe driver
标准输出
mint@mint-VirtualBox ~/Desktop/Logbook $ ls
googletest include lib main.cpp Makefile README.md src
mint@mint-VirtualBox ~/Desktop/Logbook $ make
g++ -c -I include lib/Logbook.cpp
make: g++: Command not found
Makefile:47: recipe for target 'Logbook.o' failed
make: *** [Logbook.o] Error 127
mint@mint-VirtualBox ~/Desktop/Logbook $ ls
googletest include lib main.cpp Makefile README.md src
mint@mint-VirtualBox ~/Desktop/Logbook $ g++ -c -I include lib/Logbook.cpp
mint@mint-VirtualBox ~/Desktop/Logbook $ ls
googletest include lib Logbook.o main.cpp Makefile README.md src
mint@mint-VirtualBox ~/Desktop/Logbook $
预期的结果是 g++ 在从 makefile 内部调用时可以工作,但显然不能 这里到底发生了什么?在终端中应该有标签并运行编译命令,但 Makefile 只是不想同意 g++ 命令存在。
【问题讨论】:
-
你能增加图片的大小吗,它们很难阅读。