Building binary with a version number and meta data

P

puzzlecracker

Guys,

i'm building a c++ app, and want to include a standard version and
other relavant info, like a build data. Hence a user can do ./app -r
and will have the info available.

What is the standard pattern for that? I imagine that some of that
should be read from the file.


Thanks
 
R

red floyd

puzzlecracker said:
Guys,

i'm building a c++ app, and want to include a standard version and
other relavant info, like a build data. Hence a user can do ./app -r
and will have the info available.

What is the standard pattern for that? I imagine that some of that
should be read from the file.

I'd just use a version.h file.
 
I

Ian Collins

puzzlecracker said:
Would you point to an example, perhaps of an open source?
A common technique is to have an header with either a manual or embedded
SCM version number.
 
R

Rüdiger Ranft

puzzlecracker said:
Guys,

i'm building a c++ app, and want to include a standard version and
other relavant info, like a build data. Hence a user can do ./app -r
and will have the info available.

You may consider -V or --version, like many other programms do.
What is the standard pattern for that? I imagine that some of that
should be read from the file.

Usual you build a header containing a constant with your programm
version like this:

#ifndef MY_PROG_VERSION_H__
#define MY_PROG_VERSION_H__

#define MY_PROG_VERSION_STRING "1.2.3.4-a-foo.bar"

#endif

and include this everywhere you need the version. When you use a
version control system you can also generate this header to fill the VCS
revison info into the version number.

bye
Rudi
 
R

red floyd

Rüdiger Ranft said:
You may consider -V or --version, like many other programms do.


Usual you build a header containing a constant with your programm
version like this:

#ifndef MY_PROG_VERSION_H__
#define MY_PROG_VERSION_H__

#define MY_PROG_VERSION_STRING "1.2.3.4-a-foo.bar"

#endif

and include this everywhere you need the version. When you use a
version control system you can also generate this header to fill the VCS
revison info into the version number.

OT, but kill the second trailing underscore. Double underscores are
reserved to the implementation.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,164
Messages
2,570,897
Members
47,439
Latest member
shasuze

Latest Threads

Top