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 & C++11
Forum Updated to NodeBB v4.3 + New Features

Qt Creator & C++11

Scheduled Pinned Locked Moved Qt Creator and other tools
8 Posts 5 Posters 39.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.
  • J Offline
    J Offline
    Jarzka
    wrote on last edited by
    #1

    Hello

    I've tried to use Qt Creator with the latest version of C++. I installed the latest version of MinGW, added it to the Tool Chains of Qt Creator and selected it but I got the following error message:
    warning: identifier 'nullptr' is a keyword in C++11 [-Wc++0x-compat]

    I added argument "-std=c++0x" to the Build Steps arguments list and then I got this:
    :-1: error: invalid option -- =

    Now I have no idea what to do. Can you please help me?

    Thanks.

    EDIT:
    There seems to be a problem using my installed version of MinGW anyway. If I build my project using it (without C++11) I can't see any program window.

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tomma
      wrote on last edited by
      #2

      "-std=" is C++ compiler flag, so you have to give it to compiler which can be archived by adding
      @
      QMAKE_CXXFLAGS += -std=c++11
      @

      to your .pro-file.

      I don't know about your other problem but did application work before? Does it give some errors when starting?

      1 Reply Last reply
      0
      • J Offline
        J Offline
        Jarzka
        wrote on last edited by
        #3

        Hi

        That helped. Thanks! However I'm wondering why I cannot put -std=c++11 to
        Projects -> Build Steps -> Make Details -> Make arguments

        EDIT: It seems that when I use the latest version of MinGW compiler downloaded from MinGW website the program can be compiled but the program window won't show up. This doesn't happen if I use the MinGW compiler shipped with Qt Creator. :/ And unfortunately that compiler does not support C++11.

        1 Reply Last reply
        0
        • T Offline
          T Offline
          tomma
          wrote on last edited by
          #4

          Projects -> Build Steps -> Make Details -> Make arguments are arguments for make command which handles building from Makefile which is generated by qmake.
          If your application requires C++11 then it is better to define it in project file.

          Could your other problem be caused by Qt which is built with older MinGW?

          1 Reply Last reply
          0
          • V Offline
            V Offline
            valkenar
            wrote on last edited by
            #5

            I had the same set of problems. Mine were solved by add a qmake link flags setting. These are the two lines that made C++11 work with clang++ 3.1 for me

            QMAKE_CXXFLAGS += -std=c++11 -stdlib=libc++ -mmacosx-version-min=10.6
            QMAKE_LFLAGS += -std=c++11 -stdlib=libc++ -mmacosx-version-min=10.6

            1 Reply Last reply
            0
            • V Offline
              V Offline
              valkenar
              wrote on last edited by
              #6

              Should've verified that first. The correct flags are:
              QMAKE_CXXFLAGS = -std=c++11 -stdlib=libc++ -mmacosx-version-min=10.7
              QMAKE_LFLAGS = -std=c++11 -stdlib=libc++ -mmacosx-version-min=10.7

              1 Reply Last reply
              0
              • N Offline
                N Offline
                ningen
                wrote on last edited by
                #7

                thanks for: QMAKE_CXXFLAGS = -std=c+11

                1 Reply Last reply
                0
                • T3STYT Offline
                  T3STYT Offline
                  T3STY
                  wrote on last edited by
                  #8

                  There is a much much easier way:

                  @CONFIG += c++11@

                  Put that in your project .pro file and you're done :)

                  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