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. [SOLVED] qmake: how to set W4 warning level for MSVC? QMAKE_CFLAGS_WARN_ON has no effect
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] qmake: how to set W4 warning level for MSVC? QMAKE_CFLAGS_WARN_ON has no effect

Scheduled Pinned Locked Moved General and Desktop
10 Posts 2 Posters 4.6k 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.
  • V Offline
    V Offline
    Violet Giraffe
    wrote on last edited by
    #1

    I've tried solution from this topic, and it doesn't work: https://qt-project.org/forums/viewthread/10527/
    I use Qt 4. /W4 doesn't even appear in the list of compiler flags, and /W3 isn't going anywhere.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Did you modify QMAKE_CXXFLAGS ?

      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
      0
      • V Offline
        V Offline
        Violet Giraffe
        wrote on last edited by
        #3

        Hi,
        I have QMAKE_CXXFLAGS += /MP in a .pro file, if that's what you're asking.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          You can set your flag there.

          If it's still not working, you can as a quick last resort modify your mkspec to use W4 rather than 3

          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
          0
          • V Offline
            V Offline
            Violet Giraffe
            wrote on last edited by
            #5

            Oddly enough, I've tried simply doing QMAKE_CXXFLAGS += /MP /W4 (and not touching MAKE_CFLAGS_WARN_ON), and /W4 didn't show up in the visual studio project while /MP did.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Depending on the flag order, one might be ignored for the other

              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
              0
              • V Offline
                V Offline
                Violet Giraffe
                wrote on last edited by
                #7

                I expected both /W3 (from QMAKE_CFLAGS_WARN_ON) and /W4 (from my QMAKE_CXXFLAGS) to show up, how is it possible that /W4 got lost? Does qmake perform some analysis of the flags, as opposed to simply putting QMAKE_CXXFLAGS string into the generated project blindly?

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  Did you check the content of the generated Makefiles ?

                  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
                  0
                  • V Offline
                    V Offline
                    Violet Giraffe
                    wrote on last edited by
                    #9

                    Found the problem. I was using QMAKE_CFLAGS_WARN_ON, while I needed QMAKE_CXXFLAGS_WARN_ON. Silly copy-paste mistake.

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      Then check in visual studio to see if the flag appears or not

                      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
                      0

                      • Login

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