Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to switch off specific warnings in Qt Creator
Forum Updated to NodeBB v4.3 + New Features

How to switch off specific warnings in Qt Creator

Scheduled Pinned Locked Moved Unsolved General and Desktop
15 Posts 3 Posters 254 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D DiBosco

    Using CONFIG += warn_off switches of ALL warnings though and I don't want that.

    JonBJ Online
    JonBJ Online
    JonB
    wrote last edited by
    #6

    @DiBosco
    Did you actually try it though? I read the answer as indicating/suggesting that CONFIG += warn_off is required to make QMAKE_CXXFLAGS_WARN_OFF be taken into account? The OP there seemed to say same as you: setting QMAKE_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 the CONFIG statement but not in your case?

    D 1 Reply Last reply
    0
    • JonBJ JonB

      @DiBosco
      Did you actually try it though? I read the answer as indicating/suggesting that CONFIG += warn_off is required to make QMAKE_CXXFLAGS_WARN_OFF be taken into account? The OP there seemed to say same as you: setting QMAKE_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 the CONFIG statement but not in your case?

      D Offline
      D Offline
      DiBosco
      wrote last edited by
      #7

      @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.

      JonBJ 1 Reply Last reply
      0
      • D DiBosco

        @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.

        JonBJ Online
        JonBJ Online
        JonB
        wrote last edited by JonB
        #8

        @DiBosco
        I already suggested: you ought find out why (apparently, according to you and the other poster) that without CONFIG += warn_off setting QMAKE_CXXFLAGS_WARN_OFF -= -Wdeprecated-copy has no effect. Then maybe you will be able to remove CONFIG and know what you have to do to make QMAKE_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 have CONFIG += warn_off, i.e. the latter "activates" the former's flags to be used. Without that configuration QMAKE_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 like QMAKE_CXXFLAGS? Does that satisfy you?

        D 1 Reply Last reply
        0
        • JonBJ JonB

          @DiBosco
          I already suggested: you ought find out why (apparently, according to you and the other poster) that without CONFIG += warn_off setting QMAKE_CXXFLAGS_WARN_OFF -= -Wdeprecated-copy has no effect. Then maybe you will be able to remove CONFIG and know what you have to do to make QMAKE_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 have CONFIG += warn_off, i.e. the latter "activates" the former's flags to be used. Without that configuration QMAKE_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 like QMAKE_CXXFLAGS? Does that satisfy you?

          D Offline
          D Offline
          DiBosco
          wrote last edited by
          #9

          @JonB

          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.

          D JonBJ 2 Replies Last reply
          0
          • D DiBosco

            @JonB

            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.

            D Offline
            D Offline
            DiBosco
            wrote last edited by
            #10

            @DiBosco said in How to switch off specific warnings in Qt Creator:

            @JonB

            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.

            1 Reply Last reply
            0
            • D DiBosco

              @JonB

              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.

              JonBJ Online
              JonBJ Online
              JonB
              wrote last edited by
              #11

              @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.....

              D 1 Reply Last reply
              0
              • JonBJ JonB

                @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.....

                D Offline
                D Offline
                DiBosco
                wrote last edited by
                #12

                @JonB

                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.

                JonBJ 1 Reply Last reply
                0
                • aha_1980A Offline
                  aha_1980A Offline
                  aha_1980
                  Lifetime Qt Champion
                  wrote last edited by
                  #13

                  @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

                  Qt has to stay free or it will die.

                  D 1 Reply Last reply
                  3
                  • D DiBosco

                    @JonB

                    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.

                    JonBJ Online
                    JonBJ Online
                    JonB
                    wrote last edited by JonB
                    #14

                    @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 like QMAKE_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 like THE_MACRO_WHICH_ADDED_IT -= -Wdeprecated-copy to remove it?

                    P.S.
                    Since @aha_1980 has just chimed in to say there is a QMAKE_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 on QMAKE_CXXFLAGS, but try what he says first.

                    1 Reply Last reply
                    0
                    • aha_1980A aha_1980

                      @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

                      D Offline
                      D Offline
                      DiBosco
                      wrote last edited by DiBosco
                      #15

                      @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.

                      1 Reply Last reply
                      3

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved