[英]Makefile warning: Warning: File `main.cpp' has modification time 2.1e+04 s in the future
I have a working Makefile
, but there is a warning that I couldn't fix.我有一个工作
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)
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:要扩展 Ben Voigt 的答案:
find /your/dir -type f -exec touch {} +
will update the timestamp on all files in the directory.将更新目录中所有文件的时间戳。 You can then
make clean && make
again.然后你可以再次
make clean && make
。
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.
我遇到了同样的问题,根本原因是我的电脑时间已经过去了——当我更新它时,它工作得很好。
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:
更简单的是安装 ntp 服务器:
apt install ntp
apt安装ntp
Or或者
yum install ntp
百胜安装ntp
Or ...或者 ...
Regarding of your operating system (Ubuntu, Centos, ...etc)关于您的操作系统(Ubuntu,Centos,...等)
just set your system date:只需设置您的系统日期:
example例子
date -s "2 OCT 2006 18:00:00"
I've faced the same issue, did the below approach on Ubuntu 20.04
and it worked for me.我遇到了同样的问题,在
Ubuntu 20.04
上做了以下方法,它对我有用。
touch main_.cpp
cp main.cpp main_.cpp
rm main.cpp
mv main_.cpp main.cpp
Try to use the following: 尝试使用以下内容:
rm Makefile
sudo qmake yourproj. //or any command to create the makefile again
make clean
make
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.