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?

  • 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 1 '16 at 8:53
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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.