Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Where is compiler optimization turned off/on?

    Tools
    5
    12
    12940
    Loading More Posts
    • 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.
    • mzimmers
      mzimmers last edited by

      I might want to play with this; can someone tell me where in the preferences I can find it?

      Thanks.

      1 Reply Last reply Reply Quote 0
      • G
        giesbert last edited by

        Play with them for Qt libraries or for your libraries?

        For Qt build, they are set in $(QTDIR)\mkspecs<your compiler>\qmake.conf

        Nokia Certified Qt Specialist.
        Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

        1 Reply Last reply Reply Quote 0
        • A
          andre last edited by

          Check the qmake Variable Reference documentation, and look for the entry on QMAKE_CXXFLAGS.

          1 Reply Last reply Reply Quote 0
          • G
            giesbert last edited by

            [quote author="Andre" date="1300439484"]Check the qmake Variable Reference documentation, and look for the entry on QMAKE_CXXFLAGS.[/quote]

            This is only valid, if you want to play with optimization in your executable. And then you have to take care, that they fit to Qt binaries.

            Nokia Certified Qt Specialist.
            Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

            1 Reply Last reply Reply Quote 0
            • mzimmers
              mzimmers last edited by

              [quote author="Gerolf" date="1300438870"]Play with them for Qt libraries or for your libraries?

              For Qt build, they are set in $(QTDIR)\mkspecs<your compiler>\qmake.conf[/quote]

              Thanks, Gerolf. This would be for my own programs; I'm not trying to change any Qt code.

              Since you pointed me to a file, do I gather correctly that changing these values is done directly with file manipulation, and not via a Qt interface?

              1 Reply Last reply Reply Quote 0
              • G
                giesbert last edited by

                yes, but manipulating these files is for tunig Qt itself, not your binaries.
                To tune yout binaries, look at Andre's post.
                You ahve to deal with qmake project files.

                Nokia Certified Qt Specialist.
                Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

                1 Reply Last reply Reply Quote 0
                • mzimmers
                  mzimmers last edited by

                  OK, I'll dig up the documentation and take a look. Thanks, Gerolf.

                  EDIT:

                  You know, it just occurred to me that I probably should have asked this question differently -- are the optimization options something that typically cause issues for "ordinary" developers?

                  1 Reply Last reply Reply Quote 0
                  • G
                    goetz last edited by

                    The default optimization settings for the release target are usually sufficient. I would not bother fiddling around with them unless you are doing some really heavy number crunching or multimedia decoding or the like.

                    http://www.catb.org/~esr/faqs/smart-questions.html

                    1 Reply Last reply Reply Quote 0
                    • mzimmers
                      mzimmers last edited by

                      Oh, I'm sure they're fine for the release build. I was more thinking about whether optimization is fully disabled for debug builds. I was having some weird stuff happen, and thought it was worth a look to make sure that optimization was off for debug.

                      Thanks...

                      1 Reply Last reply Reply Quote 0
                      • G
                        goetz last edited by

                        "-O2" only appears in the the QMAKE_CFLAGS_RELEASE and QMAKE_CXXFLAGS_RELEASE config variables.

                        So, from a short look, optimization should be off in all debug settings.

                        http://www.catb.org/~esr/faqs/smart-questions.html

                        1 Reply Last reply Reply Quote 0
                        • mzimmers
                          mzimmers last edited by

                          Thanks, Volker. I'm sure the weirdness I was seeing was cockpit error, then.

                          1 Reply Last reply Reply Quote 0
                          • Z
                            ZapB last edited by

                            The default debug flags are simply "-g" which is set for QMAKE_CFLAGS_DEBUG and QMAKE_CXXFLAGS_DEBUG.

                            Nokia Certified Qt Specialist
                            Interested in hearing about Qt related work

                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post