Congratulations to our 2022 Qt Champions!

[SOLVED] Build Date - Mac OSX

  • Hi,

    When I build my project, I set a variable so I get the current Date and Time (will be show in the "About my app" Dialog)

    On Windows, I use this:

    Works fine for Windows, but on MacOSX, i'd like to get the BuildDate and time also, but the code above is not working, is there any solution to do this on Mac also? Thanks!

  • Moderators

    DATE and TIME macros are defined in ISO C standard, they are supported by all compilers. It should work on Mac OS. However, I think you are trying to use them in the .pro file, right?

    An important thing is to remember that those macros are invoked at compilation time of a given file, not at linking time of the whole application. So if you are not doing a clean reabuild, you might end up with an older date.

  • Hey sierdzio thanks for your reply,

    Yes I was trying to use them in the .pro file.
    On OS X it was weirdly giving error into another object "[Audio.h] Error 2" - at compile time when theses 2 lines are not commented.

    I'm also thinking just using a Global QString that I will update on major new version manually. that way it can have a uniform format, because (DATE) use the english date.
    BUILDATE = "20/09/2014"

    Thank you!

  • Solved

    @//have to edit every new release
    const static QString date_released = "26/11/2014";@

Log in to reply