Uploaded image for project: 'Qt Visual Studio Tools'
  1. Qt Visual Studio Tools
  2. QTVSADDINBUG-939

Qt 6.2.1 and Visual Studio 2019 error compiling moc_*.cpp files missing C++17 compiler defines

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 2.7.2
    • Fix Version/s: None
    • Component/s: Build-time integration
    • Labels:
      None
    • Platform/s:
      Windows

      Description

      Hallo everybody

      I had a project perfectly compiling on Visual Studio 2019 and Qt 5.15, now I'm trying to compile it against Qt 6.2.1.

      I changed the version of C++ to C+17 on the C++ language section of the VS project settings page and I also added the /Zc:__cplusplus option to the command line of the C++ project settings.

      Everything works fine until the beginning of the compiling of the moc_.cpp files generatated by the moc tool. Those files (moc_.cpp) are not included in the VS project so I think they are processed by the moc tool but I got the error:

       

      fatal error C1189: #error:  "Qt requires a C++17 compiler, and a suitable value for __cplusplus. On MSVC, you must pass the /Zc:__cplusplus option to the compiler." (compiling source file .\GeneratedFiles\Debug\moc_offlinetransferform.cpp)
      

      How can I configure the moc tool to use C++17? Is there a workaround for this?

      Thanks

      Marco

       

        Attachments

          Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            Activity

              People

              Assignee:
              mecfc Miguel Costa
              Reporter:
              marco.beninca71 Marco Beninca
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:

                  Gerrit Reviews

                  There are no open Gerrit changes