0

在使用 Visual Studio 2012 的 C++11 功能时,我在包含“ppltasks.h”头文件时遇到了奇怪的错误(通过“未来”头文件包含:

  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>          ]

错误更长,但你明白了它的要点。有没有其他人因为简单地包含“未来”标头而遇到过这样的错误消息,是否有已知的解决方案?谢谢。

4

1 回答 1

0

事实证明,项目设置必须启用语言扩展才能正确编译标头(截至目前)。

于 2013-03-20T14:23:14.310 回答