Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
所以我想要的是有一些预处理器来提供编译时间。这样我就可以通过打印那个时间来知道我正在运行哪个版本的程序。是否可以?
#include <stdio.h> int main(void) { printf("%s %s\n", __DATE__, __TIME__); return 0; }
其他标准预定义宏
是的,使用__TIME__和__DATE__宏,如官方文档中所述。
__TIME__
__DATE__