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. New error building with MS Visual Studio
Qt 6.11 is out! See what's new in the release blog

New error building with MS Visual Studio

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 239 Views 2 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.
  • PerdrixP Offline
    PerdrixP Offline
    Perdrix
    wrote last edited by
    #1

    I just updated to MS Visual Studio 18.6 (May 2026 update).

    Now I am getting:

    3>C:\Qt\6.10.0\msvc2022_64\include\QtGui\qguiapplication.h(168,10): error C2220: the following warning is treated as an error
    3>  (compiling source file 'pch.cpp')
    3>C:\Qt\6.10.0\msvc2022_64\include\QtGui\qguiapplication.h(168,10): warning C4996: 'QCoreApplication::compressEvent': This feature will be removed in Qt 7
    

    which is a warning I have never seen before, and as I compile with /Wx, it errors. How do I shut this up.

    D.

    1 Reply Last reply
    0
    • PerdrixP Offline
      PerdrixP Offline
      Perdrix
      wrote last edited by Perdrix
      #2

      I tried wrapping the Qt includes in pch.h in:

      #if defined (Q_CC_MSVC)
      #pragma warning(push)
      #pragma warning(disable: 4996)
      #endif
         : Qt includes here  ...
      #if defined (Q_CC_MSVC)
      #pragma warning(pop)
      #endif
      
      but that changed nothing
      
      1 Reply Last reply
      0
      • Chris KawaC Offline
        Chris KawaC Offline
        Chris Kawa
        Lifetime Qt Champion
        wrote last edited by
        #3

        Those pragmas will work, but you have a chicken and egg problem here. Q_CC_MSVC is defined in one of those Qt headers, so it's not available at the top yet and thus your warning disabling isn't happening.

        You can replace Q_CC_MSVC with e.g. _MSC_VER or any other non-Qt way of identifying MSVC.

        1 Reply Last reply
        1
        • PerdrixP Offline
          PerdrixP Offline
          Perdrix
          wrote last edited by
          #4

          Face-palm! Doh! Of course!

          Thanks

          1 Reply Last reply
          0
          • I Offline
            I Offline
            Ipse
            wrote last edited by
            #5

            You can also define QT_NO_DEPRECATED_WARNINGS. Don't know is it better approach or worth.

            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