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. Qt Creator, MinGW and C++ 11.
QtWS25 Last Chance

Qt Creator, MinGW and C++ 11.

Scheduled Pinned Locked Moved Qt Creator and other tools
11 Posts 4 Posters 15.5k Views
  • 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.
  • O Offline
    O Offline
    objectref
    wrote on 23 Jan 2012, 10:59 last edited by
    #1

    Hi to all!

    I am using Qt Creator 2.4.0 on Windows 7 32bits and MinGW as the compiler (the one that came with Qt installer program). I am trying to use some features of C++ like "auto" and lambdas with no (compile) success.

    Is there a switch that i have to pass to the compiler so to be able to compile this stuff ?

    Thanks a lot for any help!

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on 23 Jan 2012, 16:01 last edited by
      #2

      add to your .pro file:

      @
      QMAKE_CXXFLAGS += -std=gnu++0x
      @

      Have a look at "this older thread":/forums/viewthread/6731 too. The tag search on c++0x should give you some additional infos too.

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

      1 Reply Last reply
      0
      • O Offline
        O Offline
        objectref
        wrote on 23 Jan 2012, 20:13 last edited by
        #3

        Ok, Volker, many thanks for the help!

        I will check it out tomorrow, when i go back to work, and report back.

        Thanks again!

        1 Reply Last reply
        0
        • L Offline
          L Offline
          lgeyer
          wrote on 24 Jan 2012, 06:37 last edited by
          #4

          C++11 support in MinGW 4.4 is mediocre, at best. Prepare for a lot of unsupported stuff and compiler crashes. I strongly advise to upgrade to a recent GCC / MinGW version.

          1 Reply Last reply
          0
          • O Offline
            O Offline
            objectref
            wrote on 24 Jan 2012, 08:32 last edited by
            #5

            @Volker:
            It (somewhat) works now. For example, the "auto" is now recognized but a line such as this:
            [] { cout << "Hello, my friends"; }();

            does not compile. So it seems that it "doesn't know" about lambdas!

            @Lukas:
            You have absolutely right...
            My Qt installer, set up compiler stuff at C:\QtSDK\mingw\bin, where i can see gcc.exe and ming32-gcc.exe (among other files) both at version 4.4.0.

            Do you think i should wait for Qt-Updater to update my installation to a more recent versions of the compiler or should (can) i do it myself without mess up anything ?

            Thank you both for the help!

            1 Reply Last reply
            0
            • L Offline
              L Offline
              lgeyer
              wrote on 24 Jan 2012, 09:08 last edited by
              #6

              I'm unaware of any plans of upgrading MinGW in the Qt SDK (please correct me if I'm wrong). I either would switch to MSVC2010 (the compiler that comes with the express edition can be used to create commercial applications at no cost as well) or a recent version of MinGW, like "TDM-GCC":http://tdm-gcc.tdragon.net/ or "MinGW-w64":http://mingw-w64.sourceforge.net/.

              1 Reply Last reply
              0
              • O Offline
                O Offline
                objectref
                wrote on 24 Jan 2012, 09:57 last edited by
                #7

                Ok, i will try this TDM-GCC package that you proposed. Have you experiment any difficulties/problems with the debugger (gdb) so far ?

                1 Reply Last reply
                0
                • L Offline
                  L Offline
                  lgeyer
                  wrote on 24 Jan 2012, 10:20 last edited by
                  #8

                  To be honest I've switched to MSVC2010 and it is quite a while since I used TDM-GCC, but feel free to come back if you experience any issues.

                  1 Reply Last reply
                  0
                  • O Offline
                    O Offline
                    objectref
                    wrote on 24 Jan 2012, 13:49 last edited by
                    #9

                    Hmm..i installed TDM-GCC and get the up-to-date MinGW stack and now, there is no way i can make GDB work again from inside Creator..."Executable failed. During startup program exited with code 0x0"

                    I cannot understand why C++ dev-stack is so complicated to setup correctly, at least on Windows.

                    Anyway.

                    1 Reply Last reply
                    0
                    • B Offline
                      B Offline
                      bmanc
                      wrote on 3 May 2012, 19:26 last edited by
                      #10

                      I tried
                      @QMAKE_CXXFLAGS += -std=c++0x@

                      and also tried
                      @QMAKE_CXXFLAGS += -std=gnu++0x@

                      in my projects, with the Qt 4.8.0 and Qt 4.8.1 on Windows 7 (64-bit). Both were using mingw4.4.

                      I get segmentation faults during the compile.

                      1 Reply Last reply
                      0
                      • B Offline
                        B Offline
                        bmanc
                        wrote on 3 May 2012, 19:40 last edited by
                        #11

                        Sorry for the almost immediate second post - I downloaded QtCreator 2.5 RC, and used the MinGW 4.6.2 that comes bundled with it. Everything compiled and ran!

                        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