我有工作Makefile,但有一个警告,我无法解决.
#Use the g++ compiler
CC = g++
# Compiler flags:
# -Wall (most warnings enabled)
# -g (for debugging with gdb)
CFLAGS = -Wall
# Executable name:
TARGET = deque_adt
all: main.o deque_adt.o deque_adt
$(TARGET): main.o deque_adt.o
$(CC) $(CFLAGS) main.o deque_adt.o -o $(TARGET)
main.o: main.cpp deque_adt.h
$(CC) $(CFLAGS) main.cpp -c
deque_adt.o: deque_adt.cpp deque_adt.h
$(CC) $(CFLAGS) deque_adt.cpp -c
clean:
rm *.o *~ $(TARGET)
Run Code Online (Sandbox Code Playgroud)
错误:
make: Warning: File `main.cpp' has modification time 2.1e+04 s in the future
g++ -Wall …Run Code Online (Sandbox Code Playgroud) 我有一个家庭作业问题说:
Destructor_Helper是一个递归函数,可以解除分配单链表的每个节点.编写destructor_helper的方法定义.
struct Node
{
string data;
Node *next;
}
void List::~List() {
destructor_helper(head);
}
Run Code Online (Sandbox Code Playgroud)
我的回答是:
void Destructor_Helper(Node *n) {
cout<< n->data << endl;
if (n->next != NULL)
Destructor_Helper(n->next);
}
Run Code Online (Sandbox Code Playgroud)
我的回答被认为是错误的,有人会帮我解决问题.