How can I find out the date of when my source code was compiled?
问题 Is it possible to store and display the date of when my project was compiled? I'd like to print this date when the program starts in order to know which version is used. Currently, I am doing this by hand, which is rather cumbersome. I am using Visual Studio 2010. 回答1: You can use the __DATE__ and __TIME__ macros - see "Predefined macros" here. As a sample, something like this: #include <iostream> int main() { using namespace std; cout << "Compiled on: " << __DATE__ << endl; cout << "Compiled