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.
  • Teemo of LOLT Offline
    Teemo of LOLT Offline
    Teemo of LOL
    wrote on 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

    sierdzioS 1 Reply Last reply
    0
    • Teemo of LOLT Teemo of LOL

      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?"

      sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on 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(:^

      Teemo of LOLT 1 Reply Last reply
      1
      • sierdzioS sierdzio

        @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.

        Teemo of LOLT Offline
        Teemo of LOLT Offline
        Teemo of LOL
        wrote on 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

        Christian EhrlicherC sierdzioS 2 Replies Last reply
        0
        • Teemo of LOLT Teemo of LOL

          @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?

          Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on 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

          Teemo of LOLT 2 Replies Last reply
          0
          • Teemo of LOLT Teemo of LOL

            @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?

            sierdzioS Offline
            sierdzioS Offline
            sierdzio
            Moderators
            wrote on 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(:^

            Teemo of LOLT 1 Reply Last reply
            0
            • Christian EhrlicherC Christian Ehrlicher

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

              $(Qt_STDCPP_)

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

              Teemo of LOLT Offline
              Teemo of LOLT Offline
              Teemo of LOL
              wrote on 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
              • Christian EhrlicherC Christian Ehrlicher

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

                $(Qt_STDCPP_)

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

                Teemo of LOLT Offline
                Teemo of LOLT Offline
                Teemo of LOL
                wrote on 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

                Christian EhrlicherC 1 Reply Last reply
                0
                • Teemo of LOLT Teemo of LOL

                  @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

                  Christian EhrlicherC Offline
                  Christian EhrlicherC Offline
                  Christian Ehrlicher
                  Lifetime Qt Champion
                  wrote on 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

                  Teemo of LOLT 1 Reply Last reply
                  0
                  • Christian EhrlicherC Christian Ehrlicher

                    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.

                    Teemo of LOLT Offline
                    Teemo of LOLT Offline
                    Teemo of LOL
                    wrote on 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
                    • Teemo of LOLT Teemo of LOL has marked this topic as solved on
                    • sierdzioS sierdzio

                      @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.

                      Teemo of LOLT Offline
                      Teemo of LOLT Offline
                      Teemo of LOL
                      wrote on 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

                      • Login

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