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. Making application run using C++14 or C++17
QtWS25 Last Chance

Making application run using C++14 or C++17

Scheduled Pinned Locked Moved Solved General and Desktop
c++14c++17application
11 Posts 8 Posters 20.8k 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.
  • Q Offline
    Q Offline
    qml.newbie
    wrote on last edited by
    #1

    I'm trying to make an application that should be able to run using C++14 and C++17 as long as the installed compiler in the system supports both. Is adding the following config in .pro file enough to accomplish that?

    CONFIG += c++14 c++17
    

    Or I need to do something more?

    Thanks.

    K aha_1980A 2 Replies Last reply
    0
    • Q qml.newbie

      I'm trying to make an application that should be able to run using C++14 and C++17 as long as the installed compiler in the system supports both. Is adding the following config in .pro file enough to accomplish that?

      CONFIG += c++14 c++17
      

      Or I need to do something more?

      Thanks.

      K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      @qml.newbie said in Making application run using C++14 or C++17:

      CONFIG += c++14 c++17
      

      Either one should be good enough. However, I would use C++17 only which should be conform with both standards.
      Otherwise you might generate eventually an ambiguity for the compiler and yourself.

      Vote the answer(s) that helped you to solve your issue(s)

      Q 1 Reply Last reply
      4
      • K koahnig

        @qml.newbie said in Making application run using C++14 or C++17:

        CONFIG += c++14 c++17
        

        Either one should be good enough. However, I would use C++17 only which should be conform with both standards.
        Otherwise you might generate eventually an ambiguity for the compiler and yourself.

        Q Offline
        Q Offline
        qml.newbie
        wrote on last edited by
        #3

        @koahnig Does writing

        CONFIG += c++17
        

        ensures that the it conforms to the requirement of being able run using both c++14 and c++17? Shouldn't I need to mention both in order to be able to run using either 14 and 17?

        W jsulmJ 2 Replies Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          It's a build flag. You build an application using one C++ standard.

          It has not much to do with running your application.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          2
          • Q qml.newbie

            @koahnig Does writing

            CONFIG += c++17
            

            ensures that the it conforms to the requirement of being able run using both c++14 and c++17? Shouldn't I need to mention both in order to be able to run using either 14 and 17?

            W Offline
            W Offline
            wrosecrans
            wrote on last edited by
            #5

            @qml.newbie All C++14 code should build just fine with a C++17 toolchain. So if you want to run with either, you should stick to the older spec. Building as c++14 will make sure you aren't using any features that are only available in 17.

            1 Reply Last reply
            3
            • fcarneyF Offline
              fcarneyF Offline
              fcarney
              wrote on last edited by fcarney
              #6

              @qml-newbie
              It might also be worth knowing what some features are supported or not supported by a compiler. Qt has defaults for using quite a few compilers. gcc, mingw, msvc, whatever mac uses, etc. At my workplace we have standardized on gcc and mingw for maximum compatibility on our platforms.

              C++ Compiler Support

              C++ is a perfectly valid school of magic.

              J.HilkJ 1 Reply Last reply
              3
              • Q qml.newbie

                I'm trying to make an application that should be able to run using C++14 and C++17 as long as the installed compiler in the system supports both. Is adding the following config in .pro file enough to accomplish that?

                CONFIG += c++14 c++17
                

                Or I need to do something more?

                Thanks.

                aha_1980A Offline
                aha_1980A Offline
                aha_1980
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @qml.newbie just a note: before Qt 5.12 you have to give c++1z instead c++17.

                Regards

                Qt has to stay free or it will die.

                1 Reply Last reply
                2
                • Q qml.newbie

                  @koahnig Does writing

                  CONFIG += c++17
                  

                  ensures that the it conforms to the requirement of being able run using both c++14 and c++17? Shouldn't I need to mention both in order to be able to run using either 14 and 17?

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

                  @qml.newbie said in Making application run using C++14 or C++17:

                  Shouldn't I need to mention both in order to be able to run using either 14 and 17?

                  No, C++17 standard contains C++14 already...

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

                  1 Reply Last reply
                  4
                  • fcarneyF fcarney

                    @qml-newbie
                    It might also be worth knowing what some features are supported or not supported by a compiler. Qt has defaults for using quite a few compilers. gcc, mingw, msvc, whatever mac uses, etc. At my workplace we have standardized on gcc and mingw for maximum compatibility on our platforms.

                    C++ Compiler Support

                    J.HilkJ Offline
                    J.HilkJ Offline
                    J.Hilk
                    Moderators
                    wrote on last edited by J.Hilk
                    #9

                    @fcarney said in Making application run using C++14 or C++17:

                    whatever mac uses

                    FYI: Clang that's at least the one you use for the precompiled Qt libs.
                    Technically, you could also go with GCC or LLVM


                    Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                    Q: What's that?
                    A: It's blue light.
                    Q: What does it do?
                    A: It turns blue.

                    SGaistS 1 Reply Last reply
                    0
                    • J.HilkJ J.Hilk

                      @fcarney said in Making application run using C++14 or C++17:

                      whatever mac uses

                      FYI: Clang that's at least the one you use for the precompiled Qt libs.
                      Technically, you could also go with GCC or LLVM

                      SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      @J.Hilk said in Making application run using C++14 or C++17:

                      @fcarney said in Making application run using C++14 or C++17:

                      whatever mac uses

                      FYI: Clang that's at least the one you use for the precompiled Qt libs.
                      Technically, you could also go with GCC or LLVM

                      While true, Qt officially only supports the clang version provided through Xcode. Also, you can still find gcc when Xcode is installed but it's a link to clang kept for building old projects.

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      1
                      • Q Offline
                        Q Offline
                        qml.newbie
                        wrote on last edited by
                        #11

                        Thanks much all of the repliers.

                        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