How to switch off specific warnings in Qt Creator
-
@DiBosco
Did you actually try it though? I read the answer as indicating/suggesting thatCONFIG += warn_off
is required to makeQMAKE_CXXFLAGS_WARN_OFF
be taken into account? The OP there seemed to say same as you: settingQMAKE_CXXFLAGS_WARN_OFF
alone did not have any effect.Try it to see if you can tell it makes a difference? Check the actual options being passed to the gcc in each case? Figure how to make
QMAKE_CXXFLAGS_WARN_OFF
actually affect things if it does it right from theCONFIG
statement but not in your case? -
@DiBosco
Did you actually try it though? I read the answer as indicating/suggesting thatCONFIG += warn_off
is required to makeQMAKE_CXXFLAGS_WARN_OFF
be taken into account? The OP there seemed to say same as you: settingQMAKE_CXXFLAGS_WARN_OFF
alone did not have any effect.Try it to see if you can tell it makes a difference? Check the actual options being passed to the gcc in each case? Figure how to make
QMAKE_CXXFLAGS_WARN_OFF
actually affect things if it does it right from theCONFIG
statement but not in your case? -
@JonB Yes, that's how I know it suppresses all warnings :)
If I put this in my .pro file:
CONFIG += warn_off QMAKE_CXXFLAGS_WARN_OFF -= -Wdeprecated-copy
No warnings at all. If I take out the:
CONFIG += warn_off
line then all warnings are present.
@DiBosco
I already suggested: you ought find out why (apparently, according to you and the other poster) that withoutCONFIG += warn_off
settingQMAKE_CXXFLAGS_WARN_OFF -= -Wdeprecated-copy
has no effect. Then maybe you will be able to removeCONFIG
and know what you have to do to makeQMAKE_CXXFLAGS_WARN_OFF -= -Wdeprecated-copy
work on its own.Not that I know anything about this, but I would guess that
QMAKE_CXXFLAGS_WARN_OFF
is only used at all if you haveCONFIG += warn_off
, i.e. the latter "activates" the former's flags to be used. Without that configurationQMAKE_CXXFLAGS_WARN_OFF
is not passed to compiler. If you want-Wdeprecated-copy
in other circumstances than with all other warnings turned off I would presume you should use another variable which is always passed to compiler. Something likeQMAKE_CXXFLAGS
? Does that satisfy you? -
@DiBosco
I already suggested: you ought find out why (apparently, according to you and the other poster) that withoutCONFIG += warn_off
settingQMAKE_CXXFLAGS_WARN_OFF -= -Wdeprecated-copy
has no effect. Then maybe you will be able to removeCONFIG
and know what you have to do to makeQMAKE_CXXFLAGS_WARN_OFF -= -Wdeprecated-copy
work on its own.Not that I know anything about this, but I would guess that
QMAKE_CXXFLAGS_WARN_OFF
is only used at all if you haveCONFIG += warn_off
, i.e. the latter "activates" the former's flags to be used. Without that configurationQMAKE_CXXFLAGS_WARN_OFF
is not passed to compiler. If you want-Wdeprecated-copy
in other circumstances than with all other warnings turned off I would presume you should use another variable which is always passed to compiler. Something likeQMAKE_CXXFLAGS
? Does that satisfy you? -
I'm not sure I've made it clear that with
CONFIG += warn_off
All warnings go. So, for example, unused variables no long show up (which I want to see).
I want all deprecated warnings to go, but I want to see other types of warning.
@DiBosco said in How to switch off specific warnings in Qt Creator:
I'm not sure I've made it clear that with
CONFIG += warn_off
All warnings go. So, for example, unused variables no long show up (which I want to see).
I want all deprecated warnings to go, but I want to see other types of warning.
PS Trying to find out what I ought to do is what I'm doing here. I spent absolutely ages trawling round various sites such as here and Stack Overflow to no avail.
-
I'm not sure I've made it clear that with
CONFIG += warn_off
All warnings go. So, for example, unused variables no long show up (which I want to see).
I want all deprecated warnings to go, but I want to see other types of warning.
@DiBosco said in How to switch off specific warnings in Qt Creator:
All warnings go. So, for example, unused variables no long show up (which I want to see).
I want all deprecated warnings to go, but I want to see other types of warning.
I know this. And I suggested why
QMAKE_CXXFLAGS_WARN_OFF
probably has no effect and precisely what you should do, which you apparently have not tried..... -
@DiBosco said in How to switch off specific warnings in Qt Creator:
All warnings go. So, for example, unused variables no long show up (which I want to see).
I want all deprecated warnings to go, but I want to see other types of warning.
I know this. And I suggested why
QMAKE_CXXFLAGS_WARN_OFF
probably has no effect and precisely what you should do, which you apparently have not tried.....I think I'm missing something here because I said a few posts up I tried:
CONFIG += warn_off QMAKE_CXXFLAGS_WARN_OFF -= -Wdeprecated-copy
So I have tried QMAKE_CXXFLAGS_WARN_OFF. Sorry if I'm being slow here, but if that's not what you mean I need something more explicit to try.
-
@DiBosco Have you already seen https://stackoverflow.com/questions/22129383/removing-unused-parameters-warning-in-qtcreator ?
For your case, it would be:
QMAKE_CXXFLAGS_WARN_ON += -Wno-deprecated-copy
Regards
-
I think I'm missing something here because I said a few posts up I tried:
CONFIG += warn_off QMAKE_CXXFLAGS_WARN_OFF -= -Wdeprecated-copy
So I have tried QMAKE_CXXFLAGS_WARN_OFF. Sorry if I'm being slow here, but if that's not what you mean I need something more explicit to try.
@DiBosco
:)- Forget about
CONFIG ...
, remove it. - Forget about
QMAKE_CXXFLAGS_WARN_OFF ...
, remove it. - Try this:
If you want
-Wdeprecated-copy
in other circumstances than with all other warnings turned off I would presume you should use another variable which is always passed to compiler. Something likeQMAKE_CXXFLAGS
? Does that satisfy you?I cannot be sure which one to use, but what happens if you add a line reading:
QMAKE_CXXFLAGS -= -Wdeprecated-copy
If that does not work we (you!) need to understand what is adding
-Wdeprecated-copy
on the gcc compiler line (I asked you to look at the actual line being generated, does it have that option?) and then presumably something likeTHE_MACRO_WHICH_ADDED_IT -= -Wdeprecated-copy
to remove it?P.S.
Since @aha_1980 has just chimed in to say there is aQMAKE_CXXFLAGS_WARN_ON
and a-Wno-deprecated-copy
which can be added you should try that. If by any chance that does not work you might have to put it onQMAKE_CXXFLAGS
, but try what he says first. - Forget about
-
@DiBosco Have you already seen https://stackoverflow.com/questions/22129383/removing-unused-parameters-warning-in-qtcreator ?
For your case, it would be:
QMAKE_CXXFLAGS_WARN_ON += -Wno-deprecated-copy
Regards
@aha_1980 said in How to switch off specific warnings in Qt Creator:
@DiBosco Have you already seen https://stackoverflow.com/questions/22129383/removing-unused-parameters-warning-in-qtcreator ?
For your case, it would be:
QMAKE_CXXFLAGS_WARN_ON += -Wno-deprecated-copy
Regards
Ah, yes I had seen that. The English in the most upticked reply just made me go "What?". Just could not understand what they were saying, but I had tried:
QMAKE_CXXFLAGS_WARN_ON += -Wdeprecated-copy
Thinking why on earth would putting the warning on make it disappear, but out of desperation I gave it a go. Had I realised it needed -Wno-deprecated-copy, not -Wdeprecated-copy I'd've been fine hours ago.
Many thanks for that, now doing just what I want.
Also @JonB Thanks for your help too.