Get compiler
-
As far as I understand, if I use mingw to compile my QT project the value _MSC_VER is undefined and if I use MSVC then it as the value of the MS compiler. I hope Iam right.
But is it also possible to get a similar value for MingW?
I need to split this define to use also if Mingw is used. Else it will use the default pragma pack that gives me issues with structures.
//#ifdef _MSC_VER || _MINGW_VER
#pragma pack(push, 1)
//#endif -
As far as I understand, if I use mingw to compile my QT project the value _MSC_VER is undefined and if I use MSVC then it as the value of the MS compiler. I hope Iam right.
But is it also possible to get a similar value for MingW?
I need to split this define to use also if Mingw is used. Else it will use the default pragma pack that gives me issues with structures.
//#ifdef _MSC_VER || _MINGW_VER
#pragma pack(push, 1)
//#endif@pixbyte said in Get compiler:
As far as I understand, if I use mingw to compile my QT project the value _MSC_VER is undefined and if I use MSVC then it as the value of the MS compiler. I hope Iam right.
Yes you are.
But is it also possible to get a similar value for MingW?
Sure, check
_GLIBCXX_RELEASE
for example. But probably it's better to use Qt's defines because they are guaranteed to work:Q_CC_GNU
Q_CC_MSVC
-
@pixbyte said in Get compiler:
As far as I understand, if I use mingw to compile my QT project the value _MSC_VER is undefined and if I use MSVC then it as the value of the MS compiler. I hope Iam right.
Yes you are.
But is it also possible to get a similar value for MingW?
Sure, check
_GLIBCXX_RELEASE
for example. But probably it's better to use Qt's defines because they are guaranteed to work:Q_CC_GNU
Q_CC_MSVC
-
@pixbyte said in Get compiler:
@sierdzio
But Q_CC_GNU means this is set on all QT platforms also with Linux and macOSThen check also for Q_OS_WIN