I'm working on a Qt Android application (Qt 5.11.1)and trying to make use of a library which checks against the version of Qt using QT_VERSION from QtGlobal.
I get errors compiling due to functions not being available and it seems to be because the reported Qt version is incorrect, (the library looks for #if QT_VERSION >= 0x050000 ...)
Adding the following trace statements;
qDebug() << "QT VERSION: " << QT_VERSION;
qDebug() << "QT STRING: " << QT_VERSION_STR;
Gives the output:
... (int main(int, char**)): QT VERSION: 330497
... (int main(int, char**)): QT STRING: 5.11.1
The string seems correct but the version number doesn't look right.
I'm working on a Windows 7 machine with Qt Creator 4.7 installed along with Qt 5.11.1 and 5.10.1 installed through the maintenance tool. The build settings are just the defaults for Android.
I'm not overly familiar with Qt and unsure of where to go from here so any help would be greatly appreciated.
According to Qt documents:
QT_VERSION
This macro expands a numeric value of the form 0xMMNNPP (MM = major, NN = minor, PP = patch) that specifies Qt's version number. For example, if you compile your application against Qt 4.1.2, the QT_VERSION macro will expand to 0x040102.
Means it has to convert to a Hex number, then it will show you the Qt version number. Your returned number is 330497, so bringing this to Hexadecimal will be 0X50B01. Since B is 11 in Decimal, the version is 5.11.1.
QT_VERSION_STR
This macro expands to a string that specifies Qt's version number (for example, "4.1.2"). This is the version against which the application is compiled.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With