Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Retrieve build version [Solved]
Forum Update on Monday, May 27th 2025

Retrieve build version [Solved]

Scheduled Pinned Locked Moved General and Desktop
10 Posts 3 Posters 4.9k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    doubitchou
    wrote on 1 Feb 2011, 13:35 last edited by
    #1

    hi,

    this a "simple" question that strangely I didn't found anywhere else in this forum and Google too :

    I need to display the build version of my software (like the one you got in the "about" dialog), please
    indicate me what to do .

    PS : I found a blog that indicates to modify the .pro with a @Version=1.2.3@
    to read it from main.cpp but that didn't worked for me

    1 Reply Last reply
    0
    • A Offline
      A Offline
      alexander
      wrote on 1 Feb 2011, 13:54 last edited by
      #2

      maybe it will work:

      .pro file:
      @DEFINES += MYVERSION=1.2.1
      VERSION = MYVERSION@

      and you also can use define MYVERSION in C++ code.

      1 Reply Last reply
      0
      • F Offline
        F Offline
        Franzk
        wrote on 1 Feb 2011, 13:55 last edited by
        #3

        Displaying version information can be nasty. There are a few practices for this.

        • Using preprocessor defines at build time
        • Using a version header file (with defines), which can be versioned and updated by a version bump tool or automatically generated by a source control tool (especially useful for build or revision numbers)
        • Using the .rc file on windows
        • Whatever we can think of...

        The VERSION thingy in the .pro file is mainly useful for a soname, but might (no experience) be used for your application as well.

        The reason you cannot really find a lot of information on it is probably because handling version information hasn't been standardized in a cross-platform or generally applicable manner in any way.

        "Horse sense is the thing a horse has which keeps it from betting on people." -- W.C. Fields

        http://www.catb.org/~esr/faqs/smart-questions.html

        1 Reply Last reply
        0
        • D Offline
          D Offline
          doubitchou
          wrote on 1 Feb 2011, 14:28 last edited by
          #4

          first of all : thanks for your answers.

          Alexander : this didn't worked for me with a read of VERSION from my main.Cpp

          Franzk : I better understand why this is so hard, nevertheless why not about a "Qt-way" resource for that purpose. This is just a think anyway.

          At last , the #define Version 1.2.3 is the same as the .pro modification (that didn't worked for me)
          In fact, I really like to be a real auto-generated number, not one I did by hand : what do you call a

          bq. version bump tool ?

          1 Reply Last reply
          0
          • A Offline
            A Offline
            alexander
            wrote on 1 Feb 2011, 14:36 last edited by
            #5

            As I know, VERSION in .pro file is used in symbian (when you install sis file).
            You can use @define MYVERSION@ in C++ code.
            For example, in our project, build system generates version.h file with @#define VESRION 1.1.0.svn revision number@
            and all modules of our program use this define.

            1 Reply Last reply
            0
            • D Offline
              D Offline
              doubitchou
              wrote on 1 Feb 2011, 14:51 last edited by
              #6

              this is really interesting as I mainly target symbian platform.

              Nevertheless as I said, this is a manual versioning.

              1 Reply Last reply
              0
              • F Offline
                F Offline
                Franzk
                wrote on 1 Feb 2011, 15:00 last edited by
                #7

                [quote author="doubitchou" date="1296570480"]what do you call a
                bq. version bump tool ?[/quote]
                It's usually a (custom) script that increases the version number, rewrites some file with the version definitions and creates a tag or label in the vcs (git, svn whatever).

                "Horse sense is the thing a horse has which keeps it from betting on people." -- W.C. Fields

                http://www.catb.org/~esr/faqs/smart-questions.html

                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  doubitchou
                  wrote on 1 Feb 2011, 15:21 last edited by
                  #8

                  how :-( , thought there were some tools to do that for me (lazy I am).

                  1 Reply Last reply
                  0
                  • F Offline
                    F Offline
                    Franzk
                    wrote on 1 Feb 2011, 15:29 last edited by
                    #9

                    Could still be, but then you'd have to invest some time in searching :P

                    "Horse sense is the thing a horse has which keeps it from betting on people." -- W.C. Fields

                    http://www.catb.org/~esr/faqs/smart-questions.html

                    1 Reply Last reply
                    0
                    • D Offline
                      D Offline
                      doubitchou
                      wrote on 1 Feb 2011, 15:40 last edited by
                      #10

                      exact, no better done than by myself.

                      A good idea would be to use QtCreator for that purpose :

                      • in the pre-build process configuration I'll add a call to a little soft that increment a version number
                        in a local file.
                      1 Reply Last reply
                      0

                      1/10

                      1 Feb 2011, 13:35

                      • Login

                      • Login or register to search.
                      1 out of 10
                      • First post
                        1/10
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved