Embed timestamp in object code at compile time with C++

后端 未结 7 894
梦谈多话
梦谈多话 2021-01-03 17:58

I want to perform a printf() to display when the currently executing code was last compiled. Does C/C++ provide a macro that gives you that resolves to a timest

7条回答
  •  感情败类
    2021-01-03 18:17

    Use a script, or create an application, to generate a C++ source file containing the build date and time. Add this file to the build setup. The other parts of the program can reference the data in this file.

    This technique is also useful for embedding a version number into the program. The build process can control the version number.

提交回复
热议问题