I have a working Makefile
, but there is a warning that I couldn't fix.
#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)
error:
make: Warning: File `main.cpp' has modification time 2.1e+04 s in the future
g++ -Wall main.cpp -c
g++ -Wall deque_adt.cpp -c
g++ -Wall main.o deque_adt.o -o deque_adt
make: warning: Clock skew detected. Your build may be incomplete.
Can someone help me out to figure out the problem? I have tried to switch between the elements but it still gives the same warning.
To expand on Ben Voigt's answer:
find /your/dir -type f -exec touch {} +
will update the timestamp on all files in the directory. You can then make clean && make
again.
That message is usually an indication that some of your files have modification times later than the current system time.
Chech if your system time is in the past. Example:
$ date
If so You have several ways to fix this. the easier one is to install an ntp server:
apt install ntp
Or
yum install ntp
Or ...
Regarding of your operating system (Ubuntu, Centos, ...etc)
check your computer time. I had the same problem and the root cause was my computer time was in the past - when I update it, it was work perfectly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With