Search code examples
c++visual-c++c++11visual-studio-2012ctp

Cannot include ppltasks.h C++11 header in VS2012


While playing around with the C++11 features of Visual Studio 2012, I encountered strange errors when including the "ppltasks.h" header file (which is included via the "future" header file:

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

The error is longer, but you get the gist of it. Has anybody else encountered such an error message from simply including the "future" header, and is there a known solution? Thanks.


Solution

  • Turns out that the Project Settings must have language extensions enabled for the header to compile correctly (as of now).