0

Basically what I need in my project is a number of some sort that iterates itself every time I build my project, and that I can output by my program.

So for example, when generating audio, I need to add metadata that states that this audio file was generated by build #1551. After I build again, that number should go to #1552.

What is the proper way to do this in Qt?

Anon
  • 3,565
  • 3
  • 27
  • 45
  • 3
    Unless you have a way to track build numbers back to the version of the source code used for the build this is rather useless, no? Instead of a build number you'd better use e.g. the git commit SHA. Anyway Qt doesn't have much to do with this, you need to setup your build system to, for example, create a header file containing the unique number before compilation starts. – stijn Dec 01 '16 at 08:53

1 Answers1

4

Proper way is:

  • Have (any possible) Version Control in your project (and forever for all projects)
  • Instead of rather useless autoincremented counter use any id, provided by VCS of choice
  • Get this id and output it (Mercurial sample, another SCMs just use another commands in $$system call)as any other variable
Lazy Badger
  • 1,935
  • 12
  • 16