microsoft / CNTK

Microsoft Cognitive Toolkit (CNTK), an open source deep-learning toolkit
https://docs.microsoft.com/cognitive-toolkit/
Other
17.53k stars 4.28k forks source link

CNTK failed due to "error C2039: 'runtime_error': is not a member of 'std'" under /permissive- + MSVC #3733

Open QuellaZhang opened 5 years ago

QuellaZhang commented 5 years ago

Environment: VS 2017 + Windows Server 2016

Description: CNTK failed due to "error C2039: 'runtime_error': is not a member of 'std'" under /permissive- mode when built on MSVC. You use std::runtime_error, but don’t have <stdexcept> included until later. Could you please help take a look at this? Thanks in advance!

Repro steps:

  1. git clone https://github.com/Microsoft/cntk D:\CNTK\src
  2. open a clean x64 prompt and browse to D:\CNTK\src
  3. set CL=/openmp- /wd4643 /wd4459 /permissive-
  4. MSBuild /m /p:Configuration=Release_CpuOnly;Platform=x64 /p:WindowsTargetPlatformVersion=10.0.17134.0 .\src\CNTK.sln /t:Rebuild

Actual result: CNTKEval.cpp D:\CNTK\src\Source\Common\Include\Eval.h(288): error C2039: 'runtime_error': is not a member of 'std' C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.16.27023\include\memory(21): note: see declaration of 'std' D:\CNTK\src\Source\Common\Include\Eval.h(288): note: This diagnostic occurred in the compiler generated function 'std::vector<Microsoft::MSR::CNTK::ValueBuffer<ElemType,Microsoft::MSR::CNTK::Vector>,std::allocator<_Ty>> Microsoft::MSR::CNTK::VariableSchema::CreateBuffers(const std::vector<size_t,std::allocator> &)' with [ _Ty=Microsoft::MSR::CNTK::ValueBuffer<ElemType,Microsoft::MSR::CNTK::Vector> ]

QuellaZhang commented 4 years ago

New same error found in file "D:\CNTK\src\Source\CNTKv2LibraryDll\API\CNTKLibraryInternals.h".

D:\CNTK\src\Source\CNTKv2LibraryDll\API\CNTKLibraryInternals.h(121): error C2039: 'runtime_error': is not a member of 'std' C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.16.27023\include\unordered_map(24): note: see declaration of 'std' D:\CNTK\src\Source\CNTKv2LibraryDll\API\CNTKLibraryInternals.h(126): error C2039: 'logic_error': is not a member of 'std' C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.16.27023\include\unordered_map(24): note: see declaration of 'std' D:\CNTK\src\Source\CNTKv2LibraryDll\API\CNTKLibraryInternals.h(131): error C2039: 'invalid_argument': is not a member of 'std' C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.16.27023\include\unordered_map(24): note: see declaration of 'std'

delzac commented 4 years ago

Maybe you can take a look at this and see is it helps?