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. disabling compiler warnings in Creator editor?
Forum Updated to NodeBB v4.3 + New Features

disabling compiler warnings in Creator editor?

Scheduled Pinned Locked Moved Solved General and Desktop
13 Posts 6 Posters 22.3k Views 4 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.
  • M Offline
    M Offline
    mzimmers
    wrote on 31 Jul 2018, 21:21 last edited by
    #1

    Hi -

    Is there a way to disable (selectively or otherwise) the compiler warnings that show up in Creator? I'm aware that I can eliminate the text of the warning by turning off line annotations, but I'm wondering whether I can eliminate them entirely.

    The warning in question is about the use of old-style casting. I can eliminate this at compile time with -Wno-old-style-cast, but I don't know how to apply that to the editor.

    Thanks...

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 31 Jul 2018, 21:23 last edited by
      #2

      Hi,

      Not in the editor (it's unrelated to it), but you can disable that in your .pro file by setting the appropriate compiler flag.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      M 1 Reply Last reply 31 Jul 2018, 21:29
      1
      • S SGaist
        31 Jul 2018, 21:23

        Hi,

        Not in the editor (it's unrelated to it), but you can disable that in your .pro file by setting the appropriate compiler flag.

        M Offline
        M Offline
        mzimmers
        wrote on 31 Jul 2018, 21:29 last edited by
        #3

        @SGaist so...no way to suppress the warning in the editor?

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 31 Jul 2018, 21:30 last edited by
          #4

          AFAIK, if you eliminate it at compile time, it should not appear in the list either.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1
          • M Offline
            M Offline
            mzimmers
            wrote on 31 Jul 2018, 21:32 last edited by
            #5

            Hmm...did I not properly form this line in my .pro file?

            QMAKE_CXXFLAGS += "-Wno-old-style-cast"
            
            1 Reply Last reply
            0
            • M Offline
              M Offline
              mrjj
              Lifetime Qt Champion
              wrote on 31 Jul 2018, 22:00 last edited by
              #6

              Hi
              Just to be sure You did not mean these ?
              alt text

              1 Reply Last reply
              0
              • M Offline
                M Offline
                mzimmers
                wrote on 31 Jul 2018, 22:02 last edited by
                #7

                No...this:
                0_1533074546596_compilerwarning.PNG

                M 1 Reply Last reply 31 Jul 2018, 22:15
                0
                • M mzimmers
                  31 Jul 2018, 22:02

                  No...this:
                  0_1533074546596_compilerwarning.PNG

                  M Offline
                  M Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on 31 Jul 2018, 22:15 last edited by
                  #8

                  @mzimmers
                  Ok it looks clangcode model but not 100% sure
                  Try Help->Plugins
                  alt text

                  Disable it and restart Creator and see.

                  1 Reply Last reply
                  6
                  • M Offline
                    M Offline
                    mzimmers
                    wrote on 31 Jul 2018, 22:20 last edited by
                    #9

                    Mrjj: that was it. Thanks very much...I'd never really had reason to look at code model options before, so I never would have found that.

                    J 1 Reply Last reply 1 Aug 2018, 05:24
                    0
                    • M mzimmers
                      31 Jul 2018, 22:20

                      Mrjj: that was it. Thanks very much...I'd never really had reason to look at code model options before, so I never would have found that.

                      J Offline
                      J Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on 1 Aug 2018, 05:24 last edited by
                      #10

                      @mzimmers If it is your own code you should rather fix these warnings instead of ignoring them.

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      4
                      • A Offline
                        A Offline
                        aha_1980
                        Lifetime Qt Champion
                        wrote on 1 Aug 2018, 05:38 last edited by aha_1980 8 Jan 2018, 05:38
                        #11

                        Hi @mzimmers,

                        As already said, better is fixing that issues - but sometimes you cannot do it for legacy projects.

                        Solution in that case is not to disable the Clang plugin, but to configure it:

                        Tools > Options > C++ > Code Model > Clang Code Model > Manage

                        There you can create your own config and apply either global or for a single project.

                        Regards

                        PS: The config switch you are looking for should be -Wno-old-style-cast

                        Qt has to stay free or it will die.

                        1 Reply Last reply
                        5
                        • M Offline
                          M Offline
                          mzimmers
                          wrote on 1 Aug 2018, 14:19 last edited by
                          #12

                          Thanks, aha. In this case, the warnings come header files supplied by a third party and intended for use with C (which I don't believe has the modern casts yet, and in any event, needs to be retroactively compatible with older compilers), so fixing them is out.

                          Thanks for the lesson on managing the code model...another part of Creator I'd never used, so that was a good thing to get exposed to.

                          K 1 Reply Last reply 1 Aug 2018, 14:48
                          1
                          • M mzimmers
                            1 Aug 2018, 14:19

                            Thanks, aha. In this case, the warnings come header files supplied by a third party and intended for use with C (which I don't believe has the modern casts yet, and in any event, needs to be retroactively compatible with older compilers), so fixing them is out.

                            Thanks for the lesson on managing the code model...another part of Creator I'd never used, so that was a good thing to get exposed to.

                            K Offline
                            K Offline
                            koahnig
                            wrote on 1 Aug 2018, 14:48 last edited by
                            #13

                            @mzimmers

                            You may also tune the clang code model and ignore single warnings to be displayed in the editor.

                            You may want to check out last of post here

                            Possibly you can switch off the macros before and on after the include. I would expect that the clang code model will be able to pick it up. As said by many before, it is not a good idea to ignore warnings. As a matter of fact I start to love the warnings shown directly in the code editor. Even though it is a bit confusing the first time ;)

                            Vote the answer(s) that helped you to solve your issue(s)

                            1 Reply Last reply
                            1

                            1/13

                            31 Jul 2018, 21:21

                            • Login

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