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. Can I use coroutines together with Qt?
QtWS25 Last Chance

Can I use coroutines together with Qt?

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 6 Posters 890 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.
  • S Offline
    S Offline
    Simmania
    wrote on last edited by
    #1

    Hi,
    I'm using At 6.22 and QtCreator at the moment. And I want to use coroutines. I did search on this topic, but it is not clear to me if I there is a compiler that does support coroutines and that can be used with QtCreater and Qt 6.22.

    Any help and info is welcome!

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Since QtCreator is just an IDE and Qt just a c++ library I don't see why it should not be possible to use a c++ feature when the used compiler supports it.
      btw: There is no QtCreator 6.22 nor Qt 6.22 anywhere out in the wild... just MS-DOS 6.22

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

      1 Reply Last reply
      2
      • S Offline
        S Offline
        Simmania
        wrote on last edited by
        #3

        Sorry that was a bit slopy of me!
        It is Qt 6.2.2 and QtCreator 6.0.2.
        I know it will depend on the compiler and not Qt. But the problem is that for coroutines one needs a recent compiler. And when manging the kits in QtCreator I do not see very recent compilers.
        I can select Microsoft Visual C++ Compiler 17.1.32210.238 (x86) as the latest MSVC compiler. And according some list on the internet I need version 19.28.
        I assume I need to compare the first digits. So the one of QtCreator is way to old.
        Using the Qt Maintanance tool I do not see a newer one.

        So what are my options here?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          The Qt Creator version has nothing to do with your issue. Install a recent enough version of Visual Studio and use it to build your project. Backward compatibility has started with VS2017.

          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
          • S Offline
            S Offline
            Simmania
            wrote on last edited by
            #5

            I have installed the latest Visual Studio tools and compiler.

            And the naming of the MSVC compiler is different in both IDEs.
            In VisualStudio they are named MSVC v142 MSVC v143 etc.
            In QtCreator they are called like "Microsoft Visual C++ Compiler 17.1.32210.238".
            So I did (and do) not see the relation between them.

            So I displayed the _MSC_VER value and it turned out to be 1931. What does that mean? What is the relation with 17.1.32210.238 (that is the one I'm using).
            Coroutines need version 19.28. I guess that 1931 is like 19.31 and thus ok?

            These MSVC compiler version numbers are very confusing!

            JonBJ D 2 Replies Last reply
            0
            • S Simmania

              I have installed the latest Visual Studio tools and compiler.

              And the naming of the MSVC compiler is different in both IDEs.
              In VisualStudio they are named MSVC v142 MSVC v143 etc.
              In QtCreator they are called like "Microsoft Visual C++ Compiler 17.1.32210.238".
              So I did (and do) not see the relation between them.

              So I displayed the _MSC_VER value and it turned out to be 1931. What does that mean? What is the relation with 17.1.32210.238 (that is the one I'm using).
              Coroutines need version 19.28. I guess that 1931 is like 19.31 and thus ok?

              These MSVC compiler version numbers are very confusing!

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by JonB
              #6

              @Simmania said in Can I use coroutines together with Qt?:

              In VisualStudio they are named MSVC v142 MSVC v143 etc.
              In QtCreator they are called like "Microsoft Visual C++ Compiler 17.1.32210.238".

              I think these are two different (legitimate) numbering/naming schemes, "MSVC++ version" vs "_MSC_VER". See the table at https://en.wikipedia.org/wiki/Microsoft_Visual_C%2B%2B, MSVC++ versions section, e.g.

              MSVC++ version .......... _MSC_VER
              14.31 .................... 1931 (Visual Studio 2022 Version 17.1)

              So that version seems to have 4 numbers: 14.x, 19.x, 2022 & 17.x :)

              1 Reply Last reply
              2
              • S Simmania

                I have installed the latest Visual Studio tools and compiler.

                And the naming of the MSVC compiler is different in both IDEs.
                In VisualStudio they are named MSVC v142 MSVC v143 etc.
                In QtCreator they are called like "Microsoft Visual C++ Compiler 17.1.32210.238".
                So I did (and do) not see the relation between them.

                So I displayed the _MSC_VER value and it turned out to be 1931. What does that mean? What is the relation with 17.1.32210.238 (that is the one I'm using).
                Coroutines need version 19.28. I guess that 1931 is like 19.31 and thus ok?

                These MSVC compiler version numbers are very confusing!

                D Offline
                D Offline
                DerReisende
                wrote on last edited by
                #7

                @Simmania a MSC VER of 1931 is according to wikipedia Visual Studio 2022 which has a very good C++20 support. So C++ wise you should be able to use the coroutine stuff defined in C++20. How this works with Qt I cannot tell as I haven’t used them yet.

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  Simmania
                  wrote on last edited by Simmania
                  #8

                  OK, I think I understand the compiler naming now.

                  One more thing. In MSVC I need to specify which C++ standard to use (e.g C++ 17 or C++ 20).
                  I do not see such a setting in QtCreator. Is that not needed?

                  I'm asking because the coroutine keywords like co_await or not recognized when using
                  #include <coroutine>

                  jsulmJ 1 Reply Last reply
                  0
                  • S Simmania

                    OK, I think I understand the compiler naming now.

                    One more thing. In MSVC I need to specify which C++ standard to use (e.g C++ 17 or C++ 20).
                    I do not see such a setting in QtCreator. Is that not needed?

                    I'm asking because the coroutine keywords like co_await or not recognized when using
                    #include <coroutine>

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

                    @Simmania said in Can I use coroutines together with Qt?:

                    I do not see such a setting in QtCreator

                    This is set in pro file if you use qmake:

                    CONFIG += c++20
                    

                    If you use CMake it is:

                    set(CMAKE_CXX_STANDARD 20)
                    

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

                    1 Reply Last reply
                    2

                    • Login

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