Important: Please read the Qt Code of Conduct -

QStringLiteral with older compilers?

  • I noticed that using the QStringLiteral macro with non lambda supporting compilers results in an error. This mandates the usage of ifdefs and more code.

    Shouldn't the macro just result in something that is either ignored or compatible with older compilers? Ignoring the macro completely lives a string literal, which is implicitly converted to a QString in places that expect a QString. I think it will be a good idea to do so instead of having to have different lines of code and ifdefs.

  • Hello utcenter,

    I am facing a similar problem.
    I have compiled my application using qmake 3.0, however when I try to cross compile it using qmake 2.01a, it gives me an error telling 'QStringLiteral' is not defined in the scope.

    Should I substitute it with 'QString'?

    Please suggest any other appropriate action.

Log in to reply