Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 608405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:27:30+00:00 2026-05-13T17:27:30+00:00

I have a library that I build and release to the customers. The platform

  • 0

I have a library that I build and release to the customers. The platform is linux.

I was wondering if there is any way to generate library version and build version as part of the build?

This will help me to co-relate any issues reported by the different customers with a particular version of the build.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T17:27:31+00:00Added an answer on May 13, 2026 at 5:27 pm

    There are 2 options:

    1. Embed the version information into the name of the library, e.g. libmy.so.1.2, which should be soft-linked into libmy.so in your installation to be able to resolve it at run-time. Modify your build tools to accommodate this. This is a common approach, but not really convenient for build labels.

    2. You can try to embed the version info into your library via some static string. On Unix you do not have resources with version information (as on Windows), so this is the only way to do it. Possible approach here can be:

    a. Create a C/C+ source file (version.cxx) with something like this:

    #include <version.h>
    static char version_stamp[]="\n@(#) " PRODUCT " " VERSION " " BUILD_NUMBER;
    

    (change format according your needs)

    b. Create version.h where you define values of PRODUCT/VERSION/BUILD_NUMBER macros. You can generate/modify this header as a part of your build process or modify it manually. E.g.:

    #define PRODUCT         "MyProduct"
    #define VERSION         "1.2.1"
    #define BUILD_NUMBER    "241"
    

    c. Make sure that your version C/C++ file (version.cxx) is linked into every library/executable in your product. Modify build tools as needed.

    Then after you link your library you can use this command to get its version:

    strings libmy.so | grep '@(#)'
    

    If you have SCCS installed on your machine (some Unixes do) you can run:

    what libmy.so
    

    (that’s why I used @(#) prefix above)

    BTW same approach can be used on Windows: just include the header mentioned above into .rc file with version resources defined (and link that .rc into every binary in your product). As result you have one place where you define version and it shared on all platforms and all binaries.

    Another benefit in (2) is that you may use the version macros from the header above in your run-time code when necessary (e.g. in log files).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a library that has both debug build and release build, how do
I have a C++ library that I build using Scons which is eventually linked
I have a library that does I/O. There are a couple of external knobs
I have a console app built on .NET 4 that uses the HttpClient library
I have a library that interacts with our phone system, ie, Hey phone, call
I have a library that I created with some business logic that includes writing
I have a library that has several options defined as this: #define shouldShowToolbar YES
Common scenario: I have a library that uses other libraries. For example, a math
Using non-thread safe libraries with threads. Say I have a library that makes a
I have a custom library that can pick mulitple images from the camera roll,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.