I have created a vc++ windows form application (VS 2010) and when I tried to include ppl.h (Parallel Patterns Library) I got the following compile error.

Error: Concurrency Runtime is not supported when compiling /clr. c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\concrt.h 27"

I want to use "parallel_for" algorithm in my program which is provided by 'VS 2010 Parallel Patterns Library'.

Can anyone tell me how to overcome the above problem and how to use 'Parallel Patterns Library' inside a windows forms application?

有帮助吗?

解决方案

You appear to be writing a WinForms managed project in C++/CLI (why?...). In the managed world there is the the Task Parallel Library (TPL) and its System::Threading::Tasks::Parallel::For. You don't have to (can't) use PPL in a project targeting the clr, at least not in the managed part of it. Are you working on a mixed (managed/unmanaged) interoperability project? If so, separate managed and native parts properly. Then, use PPL inside native component and TPL inside managed components. Have a look at this blog entry, for example.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top