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. Qt 5, C++11, and mac?
Forum Updated to NodeBB v4.3 + New Features

Qt 5, C++11, and mac?

Scheduled Pinned Locked Moved General and Desktop
17 Posts 4 Posters 5.3k 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.
  • hskoglundH Offline
    hskoglundH Offline
    hskoglund
    wrote on last edited by
    #4

    Hi, try to add this line to your .pro file:
    @MAKE_CXXFLAGS += -std=c++0x -stdlib=libc+@

    (you need this line if you are using Qt earlier than 5.2)
    (also try to update your Xcode to v.5)

    1 Reply Last reply
    0
    • C Offline
      C Offline
      CroCo
      wrote on last edited by
      #5

      [quote author="hskoglund" date="1393493638"]Hi, try to add this line to your .pro file:
      @MAKE_CXXFLAGS += -std=c++0x -stdlib=libc+@

      (you need this line if you are using Qt earlier than 5.2)
      (also try to update your Xcode to v.5)
      [/quote]

      It doesn't work.

      1 Reply Last reply
      0
      • hskoglundH Offline
        hskoglundH Offline
        hskoglund
        wrote on last edited by
        #6

        Hmmm, I had the same problem last year with Qt 5.1.

        Since then I've upgraded my project to Qt 5.2.1 and Xcode 5.02 and now I only need that line in my .pro file: (same as yours, works ok)
        @config += c++11@

        Also make sure it is a small c and not a capital C "see my blog post":http://www.tripleboot.org/?p=101

        1 Reply Last reply
        0
        • C Offline
          C Offline
          CroCo
          wrote on last edited by
          #7

          Still no hope. I'm not using Xcode 5.02, I'm not certain if this is the problem.

          1 Reply Last reply
          0
          • C Offline
            C Offline
            CroCo
            wrote on last edited by
            #8

            In Xcode, I have to do the following settings
            Build Options:
            Compiler for C/C++/Objective-C ———————> Apple LLVM compiler 3.1
            Apple LLVM compiler 3.1 – Language:
            C++ Language ——————-> C++11[-std=c++11]
            C++ Standard Library ———————> libc++ (LLVM C++ standard library with C++11 support)

            1 Reply Last reply
            0
            • sierdzioS Offline
              sierdzioS Offline
              sierdzio
              Moderators
              wrote on last edited by
              #9

              You need to inform Qt that libc++ is used instead of libstdc++.

              (Z(:^

              1 Reply Last reply
              0
              • C Offline
                C Offline
                CroCo
                wrote on last edited by
                #10

                [quote author="sierdzio" date="1393494925"]You need to inform Qt that libc++ is used instead of libstdc++.[/quote]

                How?

                1 Reply Last reply
                0
                • sierdzioS Offline
                  sierdzioS Offline
                  sierdzio
                  Moderators
                  wrote on last edited by
                  #11

                  See "here":http://stackoverflow.com/questions/14749315/clang-under-qtcreator-cant-work-with-c11.

                  (Z(:^

                  1 Reply Last reply
                  0
                  • C Offline
                    C Offline
                    CroCo
                    wrote on last edited by
                    #12

                    Still not working. :'(

                    1 Reply Last reply
                    0
                    • hskoglundH Offline
                      hskoglundH Offline
                      hskoglund
                      wrote on last edited by
                      #13

                      I'm guessing here but I seem to remember, LLVM 3.1 was a bit too old for proper C++11 support, so when LLVM 3.2 came out late 2012, C++11 worked much better in Xcode.

                      Why not trying upgrade your Xcode... it is not so expensive :-)

                      EDIT: since you're on Lion, Xcode 5 is not kosher, instead you can update to Xcode 4.6.3, which comes with LLVM 3.2 as well.

                      1 Reply Last reply
                      0
                      • C Offline
                        C Offline
                        CroCo
                        wrote on last edited by
                        #14

                        [quote author="hskoglund" date="1393496084"]I'm guessing here but I seem to remember, LLVM 3.1 was a bit too old for proper C++11 support, so when LLVM 3.2 came out late 2012, C++11 worked much better in Xcode.

                        Why not trying upgrade your Xcode... it is not so expensive :-)

                        EDIT: since you're on Lion, Xcode 5 is not kosher, instead you can update to Xcode 4.6.3, which comes with LLVM 3.2 as well.[/quote]

                        I can't upgrade Xcode because my mac version < 10.8 (really sad)

                        1 Reply Last reply
                        0
                        • C Offline
                          C Offline
                          CroCo
                          wrote on last edited by
                          #15

                          And g++ is giving me this erros
                          cc1plus: error: unrecognized command line option "-stdlib=libc++"
                          cc1plus: error: unrecognized command line option "-std=c++0x"

                          1 Reply Last reply
                          0
                          • hskoglundH Offline
                            hskoglundH Offline
                            hskoglund
                            wrote on last edited by
                            #16

                            (just edited my prev. post): yeah, I forgot you're on Lion, but as I said, Xcode 4.6.3 is the one you could try...

                            1 Reply Last reply
                            0
                            • C Offline
                              C Offline
                              CroCo
                              wrote on last edited by
                              #17

                              C++11 is working in Xcode, but I'm facing problem with the proper settings for qmake project. I've posted the settings in Xcode for c++11

                              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