Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Qt 6
  4. for C++ language standard

for C++ language standard

Scheduled Pinned Locked Moved Solved Qt 6
10 Posts 3 Posters 1.4k 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.
  • T Offline
    T Offline
    Teemo of LOL
    wrote on 7 Mar 2024, 01:32 last edited by
    #1

    The C++ language standard is specified as $(Qt_STDCPP_), but I'm not sure which version it corresponds to—C++11, C++14, C++17, C++20, or C++23. It seems different from those versions. Can someone who knows well provide more details?"

    thx

    S 1 Reply Last reply 7 Mar 2024, 06:23
    0
    • T Teemo of LOL
      7 Mar 2024, 01:32

      The C++ language standard is specified as $(Qt_STDCPP_), but I'm not sure which version it corresponds to—C++11, C++14, C++17, C++20, or C++23. It seems different from those versions. Can someone who knows well provide more details?"

      S Offline
      S Offline
      sierdzio
      Moderators
      wrote on 7 Mar 2024, 06:23 last edited by
      #2

      @Teemo-of-LOL you can specify the C++ standard you want to use in your build system (qmake or cmake or qbs). Qt will adjust to it.

      (Z(:^

      T 1 Reply Last reply 7 Mar 2024, 06:36
      1
      • S sierdzio
        7 Mar 2024, 06:23

        @Teemo-of-LOL you can specify the C++ standard you want to use in your build system (qmake or cmake or qbs). Qt will adjust to it.

        T Offline
        T Offline
        Teemo of LOL
        wrote on 7 Mar 2024, 06:36 last edited by
        #3

        @sierdzio Yes, that's correct. Although you can specify it separately, in my Qt program, it's indicated as $(Qt_STDCPP_), so I inquired about it. Could it be understood that setting $(Qt_STDCPP_) provides the C++ standard according to the version of Visual Studio?

        thx

        C S 2 Replies Last reply 7 Mar 2024, 06:47
        0
        • T Teemo of LOL
          7 Mar 2024, 06:36

          @sierdzio Yes, that's correct. Although you can specify it separately, in my Qt program, it's indicated as $(Qt_STDCPP_), so I inquired about it. Could it be understood that setting $(Qt_STDCPP_) provides the C++ standard according to the version of Visual Studio?

          C Offline
          C Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on 7 Mar 2024, 06:47 last edited by
          #4

          @Teemo-of-LOL said in for C++ language standard:

          $(Qt_STDCPP_)

          Since this variable is not documented somewhere you should not use them.

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

          T 2 Replies Last reply 7 Mar 2024, 07:05
          0
          • T Teemo of LOL
            7 Mar 2024, 06:36

            @sierdzio Yes, that's correct. Although you can specify it separately, in my Qt program, it's indicated as $(Qt_STDCPP_), so I inquired about it. Could it be understood that setting $(Qt_STDCPP_) provides the C++ standard according to the version of Visual Studio?

            S Offline
            S Offline
            sierdzio
            Moderators
            wrote on 7 Mar 2024, 07:02 last edited by
            #5

            @Teemo-of-LOL I think you should rather use some documented stuff, like __cplusplus: https://learn.microsoft.com/en-us/cpp/build/reference/zc-cplusplus?view=msvc-170

            It's not documented very well online, but each C++ standard has a well-defined value for __cplusplus.

            (Z(:^

            T 1 Reply Last reply 7 Mar 2024, 07:53
            0
            • C Christian Ehrlicher
              7 Mar 2024, 06:47

              @Teemo-of-LOL said in for C++ language standard:

              $(Qt_STDCPP_)

              Since this variable is not documented somewhere you should not use them.

              T Offline
              T Offline
              Teemo of LOL
              wrote on 7 Mar 2024, 07:05 last edited by
              #6

              @Christian-Ehrlicher It seems that using $(Qt_STDCPP_) is not recommended. Why is my program set to $(Qt_STDCPP_) for the C++ language standard? Is it necessary to modify this part? Could you please check this address: https://stackoverflow.com/questions/70373606/how-to-fix-qt-requires-a-c17-compiler? Other users also seem to have set it to $(Qt_STDCPP_)

              thx

              1 Reply Last reply
              0
              • C Christian Ehrlicher
                7 Mar 2024, 06:47

                @Teemo-of-LOL said in for C++ language standard:

                $(Qt_STDCPP_)

                Since this variable is not documented somewhere you should not use them.

                T Offline
                T Offline
                Teemo of LOL
                wrote on 7 Mar 2024, 07:17 last edited by
                #7

                @Christian-Ehrlicher It seems similar to what I found. Link: https://stackoverflow.com/questions/70373606/how-to-fix-qt-requires-a-c17-compiler. Thank you for the detailed explanation. In my case, although I don't encounter errors, it seems I need to reconfigure the C++ standard language setting. Thank you

                thx

                C 1 Reply Last reply 7 Mar 2024, 07:21
                0
                • T Teemo of LOL
                  7 Mar 2024, 07:17

                  @Christian-Ehrlicher It seems similar to what I found. Link: https://stackoverflow.com/questions/70373606/how-to-fix-qt-requires-a-c17-compiler. Thank you for the detailed explanation. In my case, although I don't encounter errors, it seems I need to reconfigure the C++ standard language setting. Thank you

                  C Offline
                  C Offline
                  Christian Ehrlicher
                  Lifetime Qt Champion
                  wrote on 7 Mar 2024, 07:21 last edited by
                  #8

                  As @sierdzio Already told you use the corresponding cmake and qmake commands to set the language standard. If this does not work for you then provide a minimal, compileable example of the problem.

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

                  T 1 Reply Last reply 7 Mar 2024, 07:43
                  0
                  • C Christian Ehrlicher
                    7 Mar 2024, 07:21

                    As @sierdzio Already told you use the corresponding cmake and qmake commands to set the language standard. If this does not work for you then provide a minimal, compileable example of the problem.

                    T Offline
                    T Offline
                    Teemo of LOL
                    wrote on 7 Mar 2024, 07:43 last edited by
                    #9

                    @Christian-Ehrlicher I have a list of C++ language standards, including C++14, C++17, and C++20. I will proceed by changing it to C++20. Thank you for letting me know

                    thx

                    1 Reply Last reply
                    0
                    • T Teemo of LOL has marked this topic as solved on 7 Mar 2024, 07:43
                    • S sierdzio
                      7 Mar 2024, 07:02

                      @Teemo-of-LOL I think you should rather use some documented stuff, like __cplusplus: https://learn.microsoft.com/en-us/cpp/build/reference/zc-cplusplus?view=msvc-170

                      It's not documented very well online, but each C++ standard has a well-defined value for __cplusplus.

                      T Offline
                      T Offline
                      Teemo of LOL
                      wrote on 7 Mar 2024, 07:53 last edited by
                      #10

                      @sierdzio I replied to someone else by mistake. I noticed it late. It seems similar to what I found. Link: https://stackoverflow.com/questions/70373606/how-to-fix-qt-requires-a-c17-compiler. Thank you for the detailed explanation. In my case, although I don't encounter errors, it seems I need to reconfigure the C++ standard language setting. Thank you

                      thx

                      1 Reply Last reply
                      0

                      1/10

                      7 Mar 2024, 01:32

                      • Login

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