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

    • Bug
    • Resolution: Fixed
    • P2: Important
    • None
    • 2.7.2
    • Build-time integration
    • None
    • 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

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

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes