Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. [SOLVED:] Parameters to gcc, like -Wno-comment
Qt 6.11 is out! See what's new in the release blog

[SOLVED:] Parameters to gcc, like -Wno-comment

Scheduled Pinned Locked Moved Qt Creator and other tools
13 Posts 2 Posters 6.4k 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.
  • A Offline
    A Offline
    aclassifier
    wrote on last edited by
    #1

    This must be very basic, but it's already taken an hour..
    I am trying to tell -Wno-comment to gcc!
    I have googled and searched here.

    The Project page gives me parameters to qmake, not to gcc? And besides, the field is not editable.
    The .pro file is probably it, but CONFIG += -Wno-comment certainly does not work.
    And http://qt-project.org/doc/qt-4.8/qmake-project-files.html I seem to have a blind eye on..

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

      Hi,

      The variable you are looking for is "this one":http://qt-project.org/doc/qt-4.8/qmake-variable-reference.html#qmake-cxxflags-warn-off

      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
      • A Offline
        A Offline
        aclassifier
        wrote on last edited by
        #3

        I saw in http://comments.gmane.org/gmane.comp.lib.qt.general/36895 that

        @QMAKE_CXXFLAGS += -Wno-comment@

        in the .pro file should work, but there is some finger trouble (more below). Same matter with

        @QMAKE_CXXFLAGS_WARN_OFF@

        which is too wide, I certainly don't want to switch off all warnings.

        The finger trouble is that either it tells me

        @Configuration unchanged, skipping qmake step.@

        even if I try to Save or Build or Rebuild or whatever..)
        or I get

        @mingw32-make: 'debug/S_ChanSched.o' is up to date.@

        even if I do Build. Seems like the tool tries to protect compiled files, perhaps to avoid having to rebuild other dependencies. But I am used to "Build" meaning unconditional build.

        Q1. Are the .pro file examples correct?

        Q2. How do I get change in it to make new makefile, and why isn't that automatic?

        Q3. How do I do a forced build?

        I am having so much finger trouble with this tool, (which up to now doesn't seem like KISS). And I can't say I am a newbie to the art either, having done this for 35 years! Ok, maybe it is that gray hair!-)

        Øyvind
        http://www.teigfam.net/oyvind/home/

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

          If the rebuild doesn't do, just delete the shadow build. From time to time it's the only option on Windows...

          Also depending on what you modify (i.e a warning flag) make won't rebuild everything since it's does not modify any actual file. Should there be something that touches every file of the project or mark something as force-rebuild when a flag is modified ? Maybe. That could make the object of a feature request for QtCreator

          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
          • A Offline
            A Offline
            aclassifier
            wrote on last edited by
            #5

            None of these seem to be picked up from the .pro file:

            @QMAKE_CXXFLAGS += -Wno-comment
            QMAKE_CXXFLAGS_WARN_OFF += -Wno-comment@

            so they must be wrong. If I quote them into qmake, they don't appear in the build either. I have some Qt users with me, and have we tried.. Help!

            1 Reply Last reply
            0
            • A Offline
              A Offline
              aclassifier
              wrote on last edited by
              #6

              I wise guy here guessed that since I have plain C project, this this might help:

              @QMAKE_CFLAGS += -Wno-comment@

              It did, since we now got it in the gcc build string:

              @gcc -c -pipe -fno-keep-inline-dllexport -Wno-comment -g -Wall -Wextra -DUNICODE -D_AUTROKEEPER_QT_PLAINC_ -D_COMPILE_WARNINGS_A_ -I..\autrokeeper_Qt_plainC -I"..\autrokeeper" -I"..\avr8" -I"..\scheduler" -I"." -I"C:\Qt\Qt5.1.0\5.1.0\mingw48_32\mkspecs\win32-g++" -o debug\S_ChanSched.o ..\scheduler\S_ChanSched.c@

              But I still got the "multi-line comment" error. Is this because it came before -Wall? If so, how do I move -Wall in front of -Wno-comment? I have experimentet and can't see a command that removes the last -Wall.

              Do I have to specify some rule in some file to get rid of the -Wall, and then introduce one myself in from of the -Wno-comment?

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

                You might have to edit the win32-g++ mkspec for that

                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
                • A Offline
                  A Offline
                  aclassifier
                  wrote on last edited by
                  #8

                  Again thanks for not giving me up!
                  I digged based on that cue, and the answer seems to go like this:

                  Comment out (with a #)

                  @QMAKE_CFLAGS_WARN_ON = -Wall -Wextra@

                  from the file (Qt installed at standard place on windows):

                  @C:\Qt\Qt5.1.0\5.1.0\mingw48_32\mkspecs\win32-g++\qmake.conf@

                  and add this in the Qt Creator .pro file:

                  @QMAKE_CFLAGS += -Wall -Wextra
                  QMAKE_CFLAGS += -Wno-comment@

                  This will make -Wno-comment overtake -Wall for that explicit warning. Build now looks like this, with -Wno-comment parsed after -Wall etc. by gcc:

                  @gcc -c -pipe -fno-keep-inline-dllexport -Wall -Wextra -Wno-comment -g -DUNICODE -D_AUTROKEEPER_QT_PLAINC_ -D_COMPILE_WARNINGS_A_ -I..\autrokeeper_Qt_plainC -I"..\autrokeeper" -I"..\avr8" -I"..\scheduler" -I"." -I"C:\Qt\Qt5.1.0\5.1.0\mingw48_32\mkspecs\win32-g++" -o debug\S_ChanSched.o ..\scheduler\S_ChanSched.c@

                  This seems to work. Please advice if there are any errors in my reasoning above. I will add [SOLVED] after some time if it's all ok.

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

                    If you want to use these option for several or all your projects, you can modify the mkspec or create your own and use that one

                    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
                    • A Offline
                      A Offline
                      aclassifier
                      wrote on last edited by
                      #10

                      Ok, where do I in case put my own? Will it override the original, or will the original have to be removed?

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

                        if you create your own, you just need copy/paste the original folder and rename it (plus make the modifications you want). Then you'll need to use the new name in the Kits configuration.

                        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
                        • A Offline
                          A Offline
                          aclassifier
                          wrote on last edited by
                          #12

                          I moved the \win32-g++ directory with the modified qmake.conf to a local directory, inside my project. Then I went through this in Qt Creator (but I am not certain if this is right and what you meant!):

                          @| Projects
                          | Manage Kits
                          | Build & Run
                          | Kits
                          | Manual
                          | Add .. name etc plus most importantly:
                          | Qt mskspec: path to new \win32-g++ directory@

                          I now have two Kits, the default and my new.

                          But do observe, I also had to move the directory "\common" to the same level as the "\win32-g++" directory, as I got a complaint. Does this have any side effect (i.e. is there a tool that would update any file(s) in any of these two directories)?

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

                            I would just have added the new mkspec in the same directory but with a different name i.e "mywin32-g++"

                            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