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. In the process of applying qt developed on Windows to Linux

In the process of applying qt developed on Windows to Linux

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 4 Posters 424 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.
  • I Offline
    I Offline
    IknowQT
    wrote on last edited by
    #1

    b5ff7a95-c03f-49d9-b8aa-6f6f06bf909c-스크린샷, 2021-10-15 12-48-05.png

    I have a question during the process of applying qt developed on Windows to Linux.
    I'm getting this error after building, is it because the syntax is different? how can i solve it?

    JKSHJ 1 Reply Last reply
    0
    • I IknowQT

      b5ff7a95-c03f-49d9-b8aa-6f6f06bf909c-스크린샷, 2021-10-15 12-48-05.png

      I have a question during the process of applying qt developed on Windows to Linux.
      I'm getting this error after building, is it because the syntax is different? how can i solve it?

      JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #2

      @IknowQT said in In the process of applying qt developed on Windows to Linux:

      is it because the syntax is different?

      I've never seen in used in a C++ for-loop before. Did it really work in Windows? What compiler did you use?

      Replace in with ,

      foreach (auto item, m_vIncuMgr)
      {
          ...
      }
      

      Even better, use the C++11 range-based for-loop: https://en.cppreference.com/w/cpp/language/range-for

      Also, in the future, please post text, not a screenshot.

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      I 1 Reply Last reply
      2
      • JKSHJ JKSH

        @IknowQT said in In the process of applying qt developed on Windows to Linux:

        is it because the syntax is different?

        I've never seen in used in a C++ for-loop before. Did it really work in Windows? What compiler did you use?

        Replace in with ,

        foreach (auto item, m_vIncuMgr)
        {
            ...
        }
        

        Even better, use the C++11 range-based for-loop: https://en.cppreference.com/w/cpp/language/range-for

        Also, in the future, please post text, not a screenshot.

        I Offline
        I Offline
        IknowQT
        wrote on last edited by
        #3

        @JKSH

        35aec3f2-d14a-43f4-a036-e86fc8e62d2d-image.png

        for each (auto item in m_vIncuMgr)
        {
        	item->setCurremtStep(Index++);
        }
        

        There was nothing wrong with the build and it worked well.
        Anyway, thanks for checking the issue.

        jsulmJ 1 Reply Last reply
        0
        • I IknowQT

          @JKSH

          35aec3f2-d14a-43f4-a036-e86fc8e62d2d-image.png

          for each (auto item in m_vIncuMgr)
          {
          	item->setCurremtStep(Index++);
          }
          

          There was nothing wrong with the build and it worked well.
          Anyway, thanks for checking the issue.

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

          @IknowQT said in In the process of applying qt developed on Windows to Linux:

          There was nothing wrong with the build and it worked well.

          I also never saw such a for loop in C++ (looks rather like a Python for loop)! Maybe this is something Microsoft invented in their C++ compiler. Anyway you should use what C++ standard specifies.

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

          1 Reply Last reply
          0
          • JonBJ Offline
            JonBJ Offline
            JonB
            wrote on last edited by JonB
            #5

            foreach (... in ...) is a C# construct, and for (... in ..) is a JavaScript one. Neither is right for Python. Not for C++, where Qt has a foreach() macro with different syntax.

            The for each (... in ...) is an MSVC-only C++ construct, per https://docs.microsoft.com/en-us/cpp/dotnet/for-each-in?view=msvc-160, and it warns:

            This non-standard keyword is available in both C++/CLI and native C++ projects. However, its use isn't recommended. Consider using a standard Range-based for Statement (C++) instead.

            :D

            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