- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I would like to have my code display automatically, when launched, a string containing the date and time of the last build I did of the code (or of some of its subroutines). How can I do this? I use Visual Studio 2005 and IVF.
Thank you!
Olivier
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I would like to have my code display automatically, when launched, a string containing the date and time of the last build I did of the code
This could be done with /Qfpp and the __DATE__ macro, as described in the Using FPP directives section of ifort documentation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This could be done with /Qfpp and the __DATE__ macro, as described in the Using FPP directives section of ifort documentation.
Thank you for the answer... I guess this only partially covers what I want to do though.
I am aware of the __DATE__ and __TIME__ variables accessible through the fpp preprocessor. This will give me the date and time at which the subroutine containing these definitions have been last compiled.
However, what I need is the time and date of the last successful build of my project... not just the last compile date/time of a particular subroutine. My original question was not clear enough.
For instance, if my main program declares/uses __DATE__ and __TIME__ and ifI mostly do work on one of the many subroutines it calls, I may very well end up with an inaccurate information... (an older build date than the actual date at which the program was linked).
Any other idea? Can we build on the use of __DATE__ etc... to get where I want to go, or should I try an alternate route?
Thanks,
Olivier
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The usual procedure, when you want the date of the last change to the build, is to put in a subroutine for this purpose, and force it to rebuild every time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The usual procedure, when you want the date of the last change to the build, is to put in a subroutine for this purpose, and force it to rebuild every time.
Tim, yes, this seems fairly logical - and I am trying to do this. This may be a silly question... but how do I force a specific subroutine to be fpp'ed and then linked with the other subroutines from within Visual Studio? Do I need to create some type of "pre-build event" ?
In other words, how do I tell Visual Studio/IVF to always fpp and compile a specific subroutine prior to compiling and linking it with the other elements of my program (even when this subroutine has not been modified)? It seems that Visual Studio will only compile subroutines which source has been changed since the last build. How does it keep track of this? Can we get around this?
Olivier
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, a pre-build event would be what you want. I did some experimentation and got this to work, but not the way I was expecting.
It seems that the preprocessor does not expand macros within quoted strings. I was trying something like:
print *, "__DATE__ __TIME__"
but what I would get is:
__DATE__ __TIME__
Upon closer reading of the docs, I see that these macros expand themselves to a quoted literal string. So this works:
print *, __DATE__, " ", __TIME__
Now the trick is to get this compiled every time. I could get this to happen with a post-build event that deleted the object from compiling the source with the __DATE__ macro, but then VS would complain if I tried to run the program because it was "out of date". So far, all of the combinations I have tried have failed in one way oe another. Perhaps someone else has an idea.
BTW. the switch to invoke the preprocessor is /fpp, not /Qfpp.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, a pre-build event would be what you want. I did some experimentation and got this to work, but not the way I was expecting.
It seems that the preprocessor does not expand macros within quoted strings. I was trying something like:
print *, "__DATE__ __TIME__"
but what I would get is:
__DATE__ __TIME__
Upon closer reading of the docs, I see that these macros expand themselves to a quoted literal string. So this works:
print *, __DATE__, " ", __TIME__
Now the trick is to get this compiled every time. I could get this to happen with a post-build event that deleted the object from compiling the source with the __DATE__ macro, but then VS would complain if I tried to run the program because it was "out of date". So far, all of the combinations I have tried have failed in one way oe another. Perhaps someone else has an idea.
BTW. the switch to invoke the preprocessor is /fpp, not /Qfpp.
Yes, this idea of deleting the object file after the build (so that it has to be compiled for the next buid) doesn't work so well... because you can't use the debugger in this case.
Anyone has a solutionfor this?
Olivier
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, this idea of deleting the object file after the build (so that it has to be compiled for the next buid) doesn't work so well... because you can't use the debugger in this case.
Anyone has a solutionfor this?
Olivier
One alternative method (not foolproof) is at runtime to read the timestamp on the .exe file.
David

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page