How can I insert compilation timestamp information into an executable I build with Visual C++ 2005? I want to be able to output something like this when I execute the program:
This build XXXX was compiled at dd-mm-yy, hh:mm.
where date and time reflect the time when the project was built. They should not change with each successive call of the program, unless it's recompiled.
Though not your exact format, DATE will be of the format Mmm dd yyyy, while TIME will be of the format hh:mm:ss. You can create a string like this and use it in whatever print routine makes sense for you:
const char *buildString = "This build XXXX was compiled at " __DATE__ ", " __TIME__ ".";
(Note on another answer: TIMESTAMP only spits out the modification date/time of the source file, not the build date/time.)