0

Just wondering how I can get the time the program was compiled into my code dynamically, I'm guessing it'll be through my makefile somehow but my Google-fu has failed today. Any help would be great!

(GCC + make *only*)

3
Contributors
3
Replies
6
Views
7 Years
Discussion Span
Last Post by nezachem
0

Just wondering how I can get the time the program was compiled into my code dynamically, I'm guessing it'll be through my makefile somehow but my Google-fu has failed today. Any help would be great!

(GCC + make *only*)

I dont know whether i understood your question correctly.
Still this is what I think,
1. Write a source file or makefile to generate a header file at the time of compilation
2. Include the current time as a macro to that header file
3. In your source code, include that header file and print the macro.

0

So obvious it was difficult to see! That's exactly what I need, thanks.

1

I see that the thread is solved. However, using __DATE__ and __TIME__ (which are stanadrd predefined macros) looks more straightforward...

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.