在使用Visual Studio 2012的C ++ 11功能时,我在包含“ppltasks.h”头文件时遇到了奇怪的错误(通过“future”头文件包含该文件:
Main.cpp
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\ppltasks.h(3306): error C2512: 'Concurrency::details::_PPLTaskHandle<Concurrency::details::_NormalizeVoidToUnitType<void>::_Type,Concurrency::task<std::pair<Concurrency::details::_Unit_type,Concurrency::details::_CancellationTokenState *>>::_ContinuationTaskHandle<_InternalReturnType,_TaskType,_Function,Concurrency::details::_FunctionTypeTraits<_Function,_ReturnType>::_Takes_task,Concurrency::details::_TaskTypeTraits<void,false>::_AsyncKind>,Concurrency::details::_ContinuationTaskHandleBase>' : no appropriate default constructor available
1> with
1> [
1> _InternalReturnType=std::pair<Concurrency::details::_Unit_type,Concurrency::details::_CancellationTokenState *>
1> , _Function=Concurrency::||::<lambda_06496b162c644bf2f90c850c3dfa7d5c>
1> , _ReturnType=std::pair<Concurrency::details::_Unit_type,Concurrency::details::_CancellationTokenState *>
1> ]
错误更长,但你得到了它的要点。有没有其他人从简单地包含“future”标题遇到这样的错误消息,是否有一个已知的解决方案?感谢。
答案 0 :(得分:0)
事实证明,项目设置必须启用语言扩展才能正确编译标题(截至目前)。