Thread: Get current program version

  1. #1
    Registered User
    Join Date
    Aug 2007
    Posts
    85

    Get current program version

    Is there some kind of preprocessor directive or macro that gives me the current version (major/minor/build/release) of the program?

  2. #2
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    This is C++. Do it yourself. lol.

  3. #3
    Registered User
    Join Date
    Aug 2007
    Posts
    85
    Neah, because my IDE autoincrements the build and.. and.. [hmm, thinks of a silly reason].. and I want to see the build number every time I run the program! :P

    If I simply wrote that in a preprocessor define, it wouldn't be fun.

  4. #4
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    So RTM with regard to your IDE/compiler and see if they support a way to get it from a preprocessor define or something (which is where they might store it).

  5. #5
    Registered User
    Join Date
    Aug 2007
    Posts
    85
    Hmm, so there is no standard way..

  6. #6
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    No. There's no such thing as a version # in a C++ program with regard to the program itself. That's just an abstract idea made up by programmers to keep track of their programs.

    TBH, you don't even have to keep the standard you suggested, with major and minor build versions.

  7. #7
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    >> my IDE autoincrements the build
    Which IDE?

  8. #8
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    Location
    Tehran
    Posts
    1,246
    because my IDE autoincrements
    I think it is incremental linking. A C++ program does not have a version in its executive, does it? If it has, it should be accessible like _TIME_ or _LINE_.
    Last edited by siavoshkc; 08-15-2007 at 01:02 PM.
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

  9. #9
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    "Auto-increment" means to automatically increase the build number by one for each build. "Incremental linking" means re-linking only those object files that have changed. They are unrelated, despite the term "increment" being in both of them.

    Some IDEs (or at least VC++) can store version and buildnumber information in the resource file for the application.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Program Plan
    By Programmer_P in forum C++ Programming
    Replies: 0
    Last Post: 05-11-2009, 01:42 AM
  2. deleting a node in linked list
    By BoneXXX in forum C Programming
    Replies: 18
    Last Post: 12-17-2007, 12:30 PM
  3. insufficient memory for tsr
    By manmohan in forum C Programming
    Replies: 8
    Last Post: 01-02-2004, 09:48 AM
  4. HelpMePlease
    By Prncess100 in forum C++ Programming
    Replies: 6
    Last Post: 12-11-2002, 02:02 PM
  5. My frist program Omhs law
    By Mac_thevamp in forum C Programming
    Replies: 7
    Last Post: 10-04-2002, 04:55 AM