Results 1 to 8 of 8

Thread: Getting VERSION from code?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Getting VERSION from code?

    Quote Originally Posted by sdfisher View Post
    Huh. This doesn't seem to work with the Visual Studio generator. I get VERSION_NUMBER=${VERSION} (with ${VERSION} not expanded) as one of my defines.

    Edit: DEFINES += VERSION_NUMBER="$${VERSION}" seems to have worked, though. Thanks for the nudge in the right direction.

    Edit #2: Actually, that doesn't seem to work, either. It adds VERSION_NUMBER="1.2.0.1" to the defines, but that doesn't seem to actually work.
    I'm afraid I never used VS integration so I can barely suggest anything more... The thing is that dependencies are probably not set properly (i.e. files using this macro won't be automatically scheduled for compilation every time the macro changes...) so you may need a "rebuild all" (or whatever it is called) to get the version number actually taken into account by your code...
    Current Qt projects : QCodeEdit, RotiDeCode

  2. #2
    Join Date
    Feb 2007
    Posts
    27
    Thanks
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Getting VERSION from code?

    I think it's just a limitation of VS (not the integration, but of VS itself). It's okay. I can use that technique on other platforms.

  3. #3
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Getting VERSION from code?

    Quote Originally Posted by sdfisher View Post
    I think it's just a limitation of VS (not the integration, but of VS itself)
    Well, I'd tend to think that it's actually a limitation of most, if not all, compilers... I'm willing to bet that no build system (may it be cmake, qmake, scons, ...) does such a smart dependency checking... Just rebuild all once you changed the version number or do a "dummy edit" in each file that rely on the version macro. Dummy edit means forcing the file to be saved, without really modifying it, which triggers dependency tracking of your build system, since most rely on time stamps and not file hash... It generally expands to typing a char then undo-ing the change and then saving...
    Current Qt projects : QCodeEdit, RotiDeCode

Similar Threads

  1. Distributing QT application for Mac OS
    By mb0 in forum Qt Programming
    Replies: 1
    Last Post: 31st May 2007, 18:59
  2. Replies: 15
    Last Post: 21st April 2007, 17:46
  3. Qt Cryptographic Architecture
    By vermarajeev in forum Qt Programming
    Replies: 6
    Last Post: 9th February 2007, 13:15
  4. Problem closing a QMainWindow in Qt4.2
    By ian in forum Qt Programming
    Replies: 11
    Last Post: 17th October 2006, 00:49

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.