12

I have many templates in my project. Everything is running fine but I've been getting this warning many times for a long time now. Should I keep ignoring it or should I use #pragma warning(disable : 4199)?

phuclv
  • 37,963
  • 15
  • 156
  • 475
BioAbner J
  • 503
  • 1
  • 4
  • 13
  • 1
    What happens, if you use the switch `/Zc:twoPhase-` like the warning suggests? – Simon Jun 27 '19 at 06:32
  • 1
    Find more info here: https://learn.microsoft.com/en-en/cpp/build/reference/zc-twophase?view=vs-2019 – Simon Jun 27 '19 at 06:36
  • 2
    @Simon [Fixed link](https://learn.microsoft.com/cpp/build/reference/zc-twophase?view=vs-2019). Basically, the C++/CLI, C++/CX and openmp variants of the compiler do not support two-phase name lookup. Sorry. – Raymond Chen Jun 27 '19 at 06:49

1 Answers1

25

Ok Thanks to Simon and Raymond's article I was able to solve it. I no more have that warning anywhere in my code. Just added the command as the article describes at it's very bottom.

Here's an image of where exactly I added the command for those like me that might have trouble finding it.

MSVC twoPhase option

phuclv
  • 37,963
  • 15
  • 156
  • 475
BioAbner J
  • 503
  • 1
  • 4
  • 13
  • 10
    I ran into this because my CLR project had [`/permissive-`](https://learn.microsoft.com/en-us/cpp/build/reference/permissive-standards-conformance?view=vs-2019) set under All Options > Additional Options. Nowadays, when you create a C++ project through Visual Studio, it will automatically set `/permissive-`, _unless_ it's a CLR project. – yxrkt Aug 19 '20 at 22:59
  • 3
    I found this option under "C/C++"/Language as the option "Conformance mode", with the values Default, Yes (/permissive-) and No (/permissive). Selecting Default solved the problem for me. – Phil Jollans Aug 01 '21 at 20:17