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.7k 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 Offline
    A Offline
    AlekseyB
    wrote on 4 Apr 2018, 14:07 last edited by AlekseyB 4 Apr 2018, 14:11
    #1

    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?

    J 1 Reply Last reply 4 Apr 2018, 14:28
    0
    • A AlekseyB
      4 Apr 2018, 14:07

      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?

      J Online
      J Online
      jsulm
      Lifetime Qt Champion
      wrote on 4 Apr 2018, 14:28 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 Apr 2018, 15:12
      4
      • J jsulm
        4 Apr 2018, 14:28

        @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 4 Apr 2018, 15:12 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
        • C Offline
          C Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on 4 Apr 2018, 18:39 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 Apr 2018, 05:45
          5
          • C Christian Ehrlicher
            4 Apr 2018, 18:39

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

            A Offline
            A Offline
            AlekseyB
            wrote on 5 Apr 2018, 05:45 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 5 Apr 2018, 05:51
            0
            • A AlekseyB
              5 Apr 2018, 05:45

              @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 5 Apr 2018, 05:51 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 5 Apr 2018, 06:51
              2
              • A ambershark
                5 Apr 2018, 05:51

                @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 5 Apr 2018, 06:51 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 7 Apr 2018, 18:37
                0
                • A ambershark
                  5 Apr 2018, 05:51

                  @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 5 Apr 2018, 08:24 last edited by
                  #8
                  This post is deleted!
                  1 Reply Last reply
                  0
                  • A AlekseyB
                    5 Apr 2018, 06:51

                    @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 7 Apr 2018, 18:37 last edited by ambershark 4 Sept 2018, 06:11
                    #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 9 Apr 2018, 05:23
                    2
                    • A ambershark
                      7 Apr 2018, 18:37

                      @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 9 Apr 2018, 05:23 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 9 Apr 2018, 06:11
                      1
                      • A AlekseyB
                        9 Apr 2018, 05:23

                        @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 9 Apr 2018, 06:11 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

                        1/11

                        4 Apr 2018, 14:07

                        • Login

                        • Login or register to search.
                        1 out of 11
                        • First post
                          1/11
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved