3

I have an app that uses Qt5.5.1 that builds fine in Visual Studio 2013. I'm trying to get it to work with the Qt5.6 Beta in Visual Studio 2015 but I'm getting new compiler warnings:

C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\vcruntime_typeinfo.h(41): error C2220: warning treated as error - no 'object' file generated
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\vcruntime_typeinfo.h(41): warning C4623: '__std_type_info_data': default constructor was implicitly defined as deleted

I'm using Warning Level 4 (/W4) and Treat Warnings As Errors (/WX). But when go to the property pages and use C/C++->Advanced->Disable Specific Warnings to disable warning 4623 I see the same problem. If I change the Warning Level to 3 (/W3) or higher the same thing happens.

Why is Visual Studio giving me a warning on its own code and why can't I disable it?

parsley72
  • 8,449
  • 8
  • 65
  • 98
  • Perhaops http://stackoverflow.com/questions/4193476/is-using-pragma-warning-push-pop-the-right-way-to-temporarily-alter-warning-lev would help – Ed Heal Jan 23 '16 at 05:40
  • Not really. I don't include vcruntime_typeinfo.h anywhere in my code and one of the answers says you can use Disable Specific Warnings instead of pragmas. – parsley72 Jan 23 '16 at 05:47
  • The file you mention must be included either directly or indirectly. Use the pragma at the start of the offending file that you compile. – Ed Heal Jan 23 '16 at 05:49
  • The warning appears hundreds of times, I'd have to add a pragma to every single file in my app. I should be able to use Disable Specific Warnings instead. – parsley72 Jan 23 '16 at 05:54
  • 1
    @parsley72 What do you type into the "Disable Specific Warnings" box? Show us resulting compiler flags (last page in compiler settings). Double check that you are building the same Configuration (Debug/Release) and Platform (x86/x64) that you set your compiler flags to. – Ivan Aksamentov - Drop Jan 23 '16 at 05:58
  • Look into the flag `/wd4624623` for the compiler – Ed Heal Jan 23 '16 at 05:59

2 Answers2

4

Thanks to @Drop's suggestion above, I checked what was shown in the Compiler Settings after I entered 4623 in the "Disable Specific Warnings" field. I was surprised to see /wd"4623". When I removed this then added /wd4623 in the "Additional Options" field the warning disappeared.

This seems like a bug in Visual Studio 2015 but I can't find any reference to it.

Update: The bug is still there in Visual Studio 2015 Update 3, so I've reported it to Microsoft and they can recreate it.

parsley72
  • 8,449
  • 8
  • 65
  • 98
  • This bug still appears to be there in VS2019 16.4.3. Do you know if Microsoft have a plan to fix it? It's fairly blatant... – egyik Jan 16 '20 at 23:36
  • Just ran into this, too! Stackoverflow to the rescue!! :-) – U. W. Dec 11 '20 at 13:03
1

use #pragma in your common header files.

For example add below lines in the header files.

// To disable warning messages 4456 and 4457.  
#pragma warning( disable : 4456 4457 ) 

See MSDN page: https://msdn.microsoft.com/en-us/library/2c8f766e.aspx

Melebius
  • 6,183
  • 4
  • 39
  • 52