天天看點

c1xx : warning C4199: C++/CLI、C++/CX 或 OpenMP 不支援兩階段名稱查找;請使用 /Zc:twoPhase-

VS2017編譯項目,報錯如下:

2>c1xx : warning C4199: C++/CLI、C++/CX 或 OpenMP 不支援兩階段名稱查找;請使用 /Zc:twoPhase-

2>c:\program files (x86)\microsoft visual studio\2017\enterprise\vc\tools\msvc\14.16.27023\include\msclr\marshal.h(222): error C3861: “_This_conversion_is_not_supported”: 找不到辨別符

2>c:\program files (x86)\microsoft visual studio\2017\enterprise\vc\tools\msvc\14.16.27023\include\msclr\marshal.h(224): note: 參見對正在編譯的 類 模闆 執行個體化 "msclr::interop::error_reporting_helper<_To_Type,_From_Type,false>" 的引用

2>c:\program files (x86)\microsoft visual studio\2017\enterprise\vc\tools\msvc\14.16.27023\include\msclr\marshal.h(233): error C3861: “_This_conversion_requires_a_context”: 找不到辨別符

2>c:\program files (x86)\microsoft visual studio\2017\enterprise\vc\tools\msvc\14.16.27023\include\msclr\marshal.h(235): note: 參見對正在編譯的 類 模闆 執行個體化 "msclr::interop::error_reporting_helper<_To_Type,_From_Type,true>" 的引用

項目背景:

C++項目,打開了/clr選項,使用了.net裡面的dll庫

分析:

two-phase name lookup應該是一個關于C++模闆的功能,錯誤提示應該是說它不支援C++/CLI, C++/CX, or OpenMP。

我的工程裡面主要是c語言的代碼,引用了一些C++的類庫,然後并沒有使用C++的模闆,是以我把two-phase name lookup關閉就好了。

解決步驟:

項目->屬性->C/C++->語言->符合模式:否

繼續閱讀