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 progra
Well... for Visual C++, there's a built in symbol called __ImageBase. Specifically:
EXTERN_C IMAGE_DOS_HEADER __ImageBase;
You can inspect that at runtime to determine the timestamp in the PE header:
const IMAGE_NT_HEADERS *nt_header= (const IMAGE_NT_HEADERS *)((char *)&__ImageBase + __ImageBase.e_lfanew);
And use nt_header->FileHeader.TimeDateStamp to get the timestamp, which is seconds from 1/1/1970.