Visual Studio time stamp for your C/C++ code

Well-liked and a simple solution.

First. Add this pre-build step to your Visual Studio project:

That little inc, contains a compile-time constant in both C and C++. I usually include it in my main C or CPP file.

Since it is generated on each build, it provokes (re)compilation of main

Usage might be

If you do not want to be bothered by GIT to commit/sync/push, that inc file, after each build, simply do not include it in a project.

In any case, if you want to use it in some more complex scenario, simply keep it in a global constant:

Enjoy …