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. What compilers do you use with Qt?
Forum Updated to NodeBB v4.3 + New Features

What compilers do you use with Qt?

Scheduled Pinned Locked Moved General and Desktop
13 Posts 7 Posters 10.5k 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.
  • C Offline
    C Offline
    Clint Westwood
    wrote on last edited by
    #1

    Since I'm moving from Visual studio I'm no longer bound to its compiler, so I'm wondering what else is out there. I don't have any certain criteria, what makes a good compiler? Which ones work best with Qt Creator?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      maximus
      wrote on last edited by
      #2

      On Windows I use the one provided with Visual Studio Community (msvc2012)
      Not sure if there is a "best" compiler, I'm not into that sort of thing maybe someone else can answer? Msvc is certainly the easiest to install.
      Have fun with Qt!


      Free Indoor Cycling Software - https://maximumtrainer.com

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        If you stick to Qt's reference configurations ("see:":http://doc.qt.io/qt-5/supported-platforms.html "and":http://doc.qt.io/QtSupportedPlatforms/index.html) then there aren't so many options left. So basically it boils down to

        • gcc on Linux
        • MSVC on Windows
        • Clang on Mac OS

        I don't see any reason to use anything else than MSVC on Windows.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          alex_malyu
          wrote on last edited by
          #4

          There is a good reason to use different than MSVC on Windows if you do heavy numerical computations and need the best optimization possible..
          In this case we go with Intel compiler. But it does not really matter when you write GUI.

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

            Hi,

            On windows you also have the MinGW package which comes with the corresponding compiler

            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
            • S Offline
              S Offline
              SysTech
              wrote on last edited by
              #6

              I have both MSVC 2013 and MinGW on Windows. My app is destined only for windows at this point so no need for linux or Mac but I have run Qt on them for test projects.

              I was a little shocked to see that code I've written under Qt using MSVC 2013 that compiles and links with no warnings but when compiled using MinGW had quite a few warnings and some errors.

              I'm sure there are command line compiler flags to change all that but it doesn't give one a great feeling. To get some things that work perfect under MSVC 2013 to even compile I had to change some references to non reference calls and there was a lot of complaining by MinGW about initialization order.

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

                @ SysTech, you would have had the same with gcc. All these compilers have different base to "complain about" even OS X's gcc and Linux gcc didn't complain about the same things.

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

                  Understood. I guess its to be expected.

                  1 Reply Last reply
                  0
                  • JKSHJ Offline
                    JKSHJ Offline
                    JKSH
                    Moderators
                    wrote on last edited by
                    #9

                    [quote author="SysTech" date="1424639572"]I was a little shocked to see that code I've written under Qt using MSVC 2013 that compiles and links with no warnings but when compiled using MinGW had quite a few warnings and some errors.

                    I'm sure there are command line compiler flags to change all that but it doesn't give one a great feeling. To get some things that work perfect under MSVC 2013 to even compile I had to change some references to non reference calls and there was a lot of complaining by MinGW about initialization order.[/quote]Spare a thought for the Qt engineers -- they worked hard to eliminate warnings on all reference compilers :)

                    Anyway, differences in what compilers are allowed could be because:

                    • One compiler is stricter than the other
                    • One compiler has a bug
                    • The compilers interpret parts of the C++ standard differently
                    • You're using a non-standard C++ extension that's supported by one compiler but not the other

                    See "here":http://forums.xkcd.com/viewtopic.php?f=11&t=83418 for example.

                    Regarding initialization order, see "here":http://stackoverflow.com/questions/12222417/why-should-i-initialize-member-variables-in-the-order-theyre-declared-in for the rationale.

                    Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      SysTech
                      wrote on last edited by
                      #10

                      JKSH
                      Thanks for list and references! Still trying to get totally up to speed.

                      One thing that was puzzling was:

                      @void TestClass::setSomething( QString &newStr )
                      {
                      m_myString = newStr;
                      }@

                      m_myString was declared in the class as:

                      @QString m_myString;@

                      This compiled, no warnings, and worked just fine in MSVC. However it caused errors in MinGW. Unfortunately I don't have the code / errors handy to list and its not that important. But I was a little puzzled.

                      Perhaps it is something about how QString is setup. I didn't spend time on it.

                      1 Reply Last reply
                      0
                      • C Offline
                        C Offline
                        Clint Westwood
                        wrote on last edited by
                        #11

                        I forgot to mention, I'm looking for full support of C++11 standart, std::thread in particular. Although reading briefly through qt docs I noticed Qt has its own thread class, is it any different?

                        With all these differences between compilers and platforms that are around, does something like "pure" C++ exists actually? Or is it rather various branches that have common roots nowadays?

                        1 Reply Last reply
                        0
                        • JKSHJ Offline
                          JKSHJ Offline
                          JKSH
                          Moderators
                          wrote on last edited by
                          #12

                          [quote author="Clint Westwood" date="1424565771"]Since I'm moving from Visual studio I'm no longer bound to its compiler, so I'm wondering what else is out there. I don't have any certain criteria, what makes a good compiler? Which ones work best with Qt Creator?[/quote]For generic compilation, both MSVC 2013 and MinGW 4.9 work perfectly well on Windows, and both support C++11.

                          If you want to use Qt Multimedia or Qt WebEngine, MSVC supports those modules better.

                          If you want to target old PCs (specifically Windows XP), then MinGW requires less work to set up.

                          [quote author="SysTech" date="1424647599"]One thing that was puzzling was:

                          @void TestClass::setSomething( QString &newStr )
                          {
                          m_myString = newStr;
                          }@

                          m_myString was declared in the class as:

                          @QString m_myString;@

                          This compiled, no warnings, and worked just fine in MSVC. However it caused errors in MinGW.[/quote]I can't see anything wrong with that code, so I have no idea what cause it (the error message would be useful though). On a side note, the Qt convention is to use a const reference instead of modifiable reference.

                          [quote author="Clint Westwood" date="1424647819"]I forgot to mention, I'm looking for full support of C++11 standart, std::thread in particular. Although reading briefly through qt docs I noticed Qt has its own thread class, is it any different?[/quote]Both MSVC 2013 and MinGW 4.9 support std::thread. QThread can easily run an event loop, so you can use signals and slots between threads (that's much harder with std::thread)

                          Note that Qt has a few different ways to use threads, not just QThread. See "Multithreading Technologies in Qt":http://doc.qt.io/qt-5/threads-technologies.html

                          [quote author="Clint Westwood" date="1424647819"]With all these differences between compilers and platforms that are around, does something like "pure" C++ exists actually? Or is it rather various branches that have common roots nowadays?[/quote]Each compiler has its own extensions to C++, but you can ignore the extensions and stick to standards-compliant C++.

                          See:

                          • https://msdn.microsoft.com/en-us/library/34h23df8.aspx
                          • https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Extensions.html

                          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                          1 Reply Last reply
                          0
                          • C Offline
                            C Offline
                            Clint Westwood
                            wrote on last edited by
                            #13

                            Thanks for answers!

                            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