Build and Build Date

Started by
3 comments, last by bkt 19 years, 10 months ago
I''m looking for a way to report the build number, and the build date of the dll/programs loaded. Is there any easy way to do this -- I wasn''t sure if MSVC++ 6.0 did that automatically (atleast, I couldn''t find any way of seeing so). If someone has an answer, please, it would be very appreciated. I want to be able to stamp my engine DLLs with build numbers, and build dates/times. Thanks, -John "bkt" Bellone Flipside Software FlipEngine!
-John "bKT" Bellone [homepage] [[email=j.bellone@flipsidesoftware.com]email[/email]]
Advertisement
You can a version information resource (in the same manner as any other standard resource type) in MSVC 6. I don''t think the IDE has any method to automatically increment the build version automatically. (Though I could be wrong on that count. Most projects that I''ve been on that actually track build numbers use an independent build process.)

You can also use the /VERSION linker flag, though that probably doesn''t do what you expect.
Here's a hacky trick I used once to get automatic build numbers in MSVC:
Create a file that looks like this:
#define BUILDNUMBER 0  

Create a file in your favorite scripting language (or just use C/c++) that reads in the file, extracts the number, increments it and writes it back out. I used python:
file=open('build.h','r')line=file.readline().split(' ')num=int(line[2])+1file.close()file=open('build.h','w')file.write('#define BUILDNUMBER %i\n' % num)file.close()  

Now add that script to post-build step (in project settings)
just #include 'build.h' when you need the buildnumber.

Whenever you build your project, it changes the file, so next time you build it'll get updated.
(One slight problem with this is since build.h is always modified, MSVC++ will always want to rebuild when you try to run the project. (just say no)
It shouldn't be too hard to expand this to do date as well.


[edited by - TravisWells on May 27, 2004 11:18:48 PM]
I think that that method sounds better, only because I want this to be cross-platform and work properly. Thanks both of you, never fails to find someone with an answer on GD!


-John "bkt" Bellone
Flipside Software
FlipEngine!
-John "bKT" Bellone [homepage] [[email=j.bellone@flipsidesoftware.com]email[/email]]
I actually use the Win32 resources to do something similiar so I can distinguish between release and internal bulds. In VC++ 6 You can create a VERSION resource, fill in the blanks such as version, copyright trademarks etc. and just compile it - no additional flags or code required. Also, the information you enter will stamped in header block of your exe or DLL meaning that it will show up when someone does a right click->properies from a file explorer window. To automatate it, the perl script idea mentioned before sounds good.

This topic is closed to new replies.

Advertisement