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. QtCreator and MSVC2015: uses default compiler switches
Qt 6.11 is out! See what's new in the release blog

QtCreator and MSVC2015: uses default compiler switches

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 2.3k Views 2 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.
  • F Offline
    F Offline
    floatingWoods
    wrote on last edited by
    #1

    Hello,

    I recently switched from MinGW to MSVC2015 for my Qt application, mainly in order to be able to build 64bit binaries. I noticed that the 64 bit binaries run slower than with MinGW and 32 bit. So I wanted to play with the various compiler switches to see if I can squeeze a little bit more out. To my surprize I noticed that QtCreator would automatically add compiler switches like following:

    -O2 -W34100 -W34189 -W44456, etc.

    If I add myself compiler switches in the *.pro file (e.g. with QMAKE_CXXFLAGS += -=O2), then some switches appear as duplicates in the compile output. But that also means that some switches can be in conflict with each other, meaning that finally I am not in control of which switches are applies.

    So my question: where are the default compiler switches added to the Qt builds (when building via QtCreator)?

    I am using Qt 5.6.1, Qt Creator 4.0.3, MSVC 2015 for 64bit builds)

    Thanks for any insight

    1 Reply Last reply
    0
    • Chris KawaC Online
      Chris KawaC Online
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Flags passed to your toolchain are defined int the qmake.conf file of the kit you're using. They are placed in the mkspecs directory of your Qt installation. For VS2015 this would be the file <Qt install dir>/mkspecs/win32-msvc2015/qmake.conf, which includes <Qt install dir>/mkspecs/common/msvc-desktop.conf. The second one contains the switches you mentioned.

      F 1 Reply Last reply
      3
      • F Offline
        F Offline
        floatingWoods
        wrote on last edited by
        #3

        Thanks a lot for your quick reply Chris. Working nicely now!!

        1 Reply Last reply
        0
        • Chris KawaC Chris Kawa

          Flags passed to your toolchain are defined int the qmake.conf file of the kit you're using. They are placed in the mkspecs directory of your Qt installation. For VS2015 this would be the file <Qt install dir>/mkspecs/win32-msvc2015/qmake.conf, which includes <Qt install dir>/mkspecs/common/msvc-desktop.conf. The second one contains the switches you mentioned.

          F Offline
          F Offline
          floatingWoods
          wrote on last edited by
          #4

          @Chris-Kawa I have to ask again a similar question: now I want to remove the /Zc:StrictStrings switch that is automatically set. I need to do this because the code I am compiling generates tons of errors of type C4244, and it wasn't doing this with MinGW. That code is a third-party code and difficult to modify, so I want to remove that switch.

          But to my surprise, there is no such switch in the configuration file you suggest, and I am now at a loss how to remove that compiler switch.
          Following doesn't work in the *.pro file:

          QMAKE_CXXFLAGS_RELEASE -= -ZcstrictStrings
          
          F 1 Reply Last reply
          0
          • F floatingWoods

            @Chris-Kawa I have to ask again a similar question: now I want to remove the /Zc:StrictStrings switch that is automatically set. I need to do this because the code I am compiling generates tons of errors of type C4244, and it wasn't doing this with MinGW. That code is a third-party code and difficult to modify, so I want to remove that switch.

            But to my surprise, there is no such switch in the configuration file you suggest, and I am now at a loss how to remove that compiler switch.
            Following doesn't work in the *.pro file:

            QMAKE_CXXFLAGS_RELEASE -= -ZcstrictStrings
            
            F Offline
            F Offline
            floatingWoods
            wrote on last edited by
            #5

            @floatingWoods I think I can answer to myself: <Qt install dir>/mkspecs/common/msvc-desktop.conf contains yet another include file (msvc-base.conf), which contains the switches I was looking for. Sorry for the noise

            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