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. How right set using both C++11 and C++14 new features?
Forum Updated to NodeBB v4.3 + New Features

How right set using both C++11 and C++14 new features?

Scheduled Pinned Locked Moved Solved General and Desktop
11 Posts 4 Posters 2.8k 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.
  • A AlekseyB

    In my pro- file I added such lines:

    CONFIG += c++11
    CONFIG += c++14
    

    On the other hand, C ++ 14 is a later standard, and it is probably necessary to write only:

    CONFIG += c++14
    

    How right?
    And why is it not possible to indicate support for the new features of the C++17?

    jsulmJ Offline
    jsulmJ Offline
    jsulm
    Lifetime Qt Champion
    wrote on last edited by
    #2

    @AlekseyB said in How right set using both C++11 and C++14 new features?:

    CONFIG += c++14

    is enough.
    "And why is it not possible to indicate support for the new features of the C++17?" - why is it not possible? Does your compiler support C++17?

    https://forum.qt.io/topic/113070/qt-code-of-conduct

    A 1 Reply Last reply
    4
    • jsulmJ jsulm

      @AlekseyB said in How right set using both C++11 and C++14 new features?:

      CONFIG += c++14

      is enough.
      "And why is it not possible to indicate support for the new features of the C++17?" - why is it not possible? Does your compiler support C++17?

      A Offline
      A Offline
      AlekseyB
      wrote on last edited by
      #3

      @jsulm said in How right set using both C++11 and C++14 new features?:

      why is it not possible? Does your compiler support C++17?

      Yes, I use GCC and Intel compiler: http://en.cppreference.com/w/cpp/compiler_support

      In this article http://doc.qt.io/qt-5/qmake-variable-reference.html#config I'm not found option

      CONFIG += c++17
      
      1 Reply Last reply
      0
      • Christian EhrlicherC Online
        Christian EhrlicherC Online
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #4

        You can use c++1z as option or simply add the appropriate compiler options directly to CXXFLAGS

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        A 1 Reply Last reply
        5
        • Christian EhrlicherC Christian Ehrlicher

          You can use c++1z as option or simply add the appropriate compiler options directly to CXXFLAGS

          A Offline
          A Offline
          AlekseyB
          wrote on last edited by
          #5

          @Christian-Ehrlicher said in How right set using both C++11 and C++14 new features?:

          You can use c++1z as option or simply add the appropriate compiler options directly to CXXFLAGS

          Сan you write a specific line for the pro- file?

          A 1 Reply Last reply
          0
          • A AlekseyB

            @Christian-Ehrlicher said in How right set using both C++11 and C++14 new features?:

            You can use c++1z as option or simply add the appropriate compiler options directly to CXXFLAGS

            Сan you write a specific line for the pro- file?

            A Offline
            A Offline
            ambershark
            wrote on last edited by
            #6

            @AlekseyB Here it is, however keep in mind C++17 support is super experimental in gcc at least. I would be careful relying on it.

            QMAKE_CXXFLAGS += -std=c++1z

            From the help on gcc:

             c++1z
                           The next revision of the ISO C++ standard, tentatively planned for
                           2017.  Support is highly experimental, and will almost certainly
                           change in incompatible ways in future releases.
            

            My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

            A 2 Replies Last reply
            2
            • A ambershark

              @AlekseyB Here it is, however keep in mind C++17 support is super experimental in gcc at least. I would be careful relying on it.

              QMAKE_CXXFLAGS += -std=c++1z

              From the help on gcc:

               c++1z
                             The next revision of the ISO C++ standard, tentatively planned for
                             2017.  Support is highly experimental, and will almost certainly
                             change in incompatible ways in future releases.
              
              A Offline
              A Offline
              AlekseyB
              wrote on last edited by
              #7

              @ambershark said in How right set using both C++11 and C++14 new features?:

              QMAKE_CXXFLAGS += -std=c++1z

              Thank you!
              I found that this line is also valid for the Intel compiler: https://software.intel.com/en-us/articles/c17-features-supported-by-intel-c-compiler

              Do I need if there is a line:

              QMAKE_CXXFLAGS + = -std = c ++ 1z
              

              leave a line

              CONFIG + = c ++ 14
              

              because these settings are set in different sections?

              A 1 Reply Last reply
              0
              • A ambershark

                @AlekseyB Here it is, however keep in mind C++17 support is super experimental in gcc at least. I would be careful relying on it.

                QMAKE_CXXFLAGS += -std=c++1z

                From the help on gcc:

                 c++1z
                               The next revision of the ISO C++ standard, tentatively planned for
                               2017.  Support is highly experimental, and will almost certainly
                               change in incompatible ways in future releases.
                
                A Offline
                A Offline
                AlekseyB
                wrote on last edited by
                #8
                This post is deleted!
                1 Reply Last reply
                0
                • A AlekseyB

                  @ambershark said in How right set using both C++11 and C++14 new features?:

                  QMAKE_CXXFLAGS += -std=c++1z

                  Thank you!
                  I found that this line is also valid for the Intel compiler: https://software.intel.com/en-us/articles/c17-features-supported-by-intel-c-compiler

                  Do I need if there is a line:

                  QMAKE_CXXFLAGS + = -std = c ++ 1z
                  

                  leave a line

                  CONFIG + = c ++ 14
                  

                  because these settings are set in different sections?

                  A Offline
                  A Offline
                  ambershark
                  wrote on last edited by ambershark
                  #9

                  @AlekseyB said in How right set using both C++11 and C++14 new features?:

                  Do I need if there is a line:
                  QMAKE_CXXFLAGS + = -std = c ++ 1z

                  leave a line
                  CONFIG + = c ++ 14

                  You don't need the CONFIG line if you are using the QMAKE_CXXFLAGS line. They both do similar things. Using CONFIG will just have Qt set the proper setting for you based on which compiler you are using. The -std=c++1z is for gcc and would not work on say MSVC's compiler. So you need to be aware of that if you intend to compile for other platforms. That's the benefit of using CONFIG for your c++ setting.

                  Also side note, you can't use spaces like you do in -std = c++1z it won't work. It has to be -std=c++1z.

                  My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

                  A 1 Reply Last reply
                  2
                  • A ambershark

                    @AlekseyB said in How right set using both C++11 and C++14 new features?:

                    Do I need if there is a line:
                    QMAKE_CXXFLAGS + = -std = c ++ 1z

                    leave a line
                    CONFIG + = c ++ 14

                    You don't need the CONFIG line if you are using the QMAKE_CXXFLAGS line. They both do similar things. Using CONFIG will just have Qt set the proper setting for you based on which compiler you are using. The -std=c++1z is for gcc and would not work on say MSVC's compiler. So you need to be aware of that if you intend to compile for other platforms. That's the benefit of using CONFIG for your c++ setting.

                    Also side note, you can't use spaces like you do in -std = c++1z it won't work. It has to be -std=c++1z.

                    A Offline
                    A Offline
                    AlekseyB
                    wrote on last edited by
                    #10

                    @ambershark

                    Thank you!

                    -std=c++1x
                    

                    also suitable for Intel compiler. I use only these two compilers, without going over to the side of evil :)

                    A 1 Reply Last reply
                    1
                    • A AlekseyB

                      @ambershark

                      Thank you!

                      -std=c++1x
                      

                      also suitable for Intel compiler. I use only these two compilers, without going over to the side of evil :)

                      A Offline
                      A Offline
                      ambershark
                      wrote on last edited by
                      #11

                      @AlekseyB said in How right set using both C++11 and C++14 new features?:

                      without going over to the side of evil :)

                      Haha nice! Me too, I try to avoid the evil side. ;)

                      My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

                      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