Search code examples
c++mfcvisual-studio-2019c++20atl

ATL project not compiling in C++ 20 standard in VS2019


I created a sample ATL project and I need to use some C++ 20 features.

When changed the C++ language standard to C++ 20 in project properties, getting a compilation error in afxhtml.h

1>pch.cpp
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\atlmfc\include\afxhtml.h(547,33): error C2760: syntax error: unexpected token 'identifier', expected ';'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\atlmfc\include\afxhtml.h(1557): message : see reference to class template instantiation 'CHtmlEditCtrlBase<T>' being compiled
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\atlmfc\include\afxhtml.h(570,33): error C2760: syntax error: unexpected token 'identifier', expected ';'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\atlmfc\include\afxhtml.h(630,33): error C2760: syntax error: unexpected token 'identifier', expected ';'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\atlmfc\include\afxhtml.h(650,33): error C2760: syntax error: unexpected token 'identifier', expected ';'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\atlmfc\include\afxhtml.h(676,33): error C2760: syntax error: unexpected token 'identifier', expected ';'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\atlmfc\include\afxhtml.h(693,33): error C2760: syntax error: unexpected token 'identifier', expected ';'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\atlmfc\include\afxhtml.h(718,15): error C3861: 'CW2CW': identifier not found
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\atlmfc\include\afxhtml.h(718,22): message : 'CW2CW': function declaration must be available as none of the arguments depend on a template parameter

The same works fine in sample console application


Solution

  • I have added a /permissive option in compiler setting, it is compiling now