Hello,
Just wondering if there was a standard way people add a version number to their c++ code? I can just define a variable or #define and write the version number to that, but wanted to know if there is a standard method people use? thanks
I don't know if there is a standard way. I normally just have a header file which I include into my program with a whole bunch of const variables defining the program. Here is an example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#ifndef __VERSION_H_INCLUDED__
#define __VERSION_H_INCLUDED__
namespace version {
// version 1.5.3
constint major = 1;
constint minor = 5;
constint revision = 3;
// readable version string
constchar* const string = "1.5.3";
} // namespace version
#endif //__VERSION_H_INCLUDED__
And then access my versions like this (for example):
window->setTitle("My Program - version " + std::string(version::string));