Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Makefile warning: Warning: File `main.cpp' has modification time 2.1e+04 s in the future

Tags:

linux

makefile

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.

like image 262
user3467152 Avatar asked Apr 24 '14 22:04

user3467152


3 Answers

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.

like image 54
that other guy Avatar answered Oct 17 '22 07:10

that other guy


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)

like image 33
MedBadr Avatar answered Oct 17 '22 07:10

MedBadr


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.

like image 23
RRR Avatar answered Oct 17 '22 05:10

RRR