2

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?

Sean O'Toole
  • 4,304
  • 6
  • 35
  • 43
user1815763
  • 103
  • 2
  • 10
  • You can move the code to a cpp that is completely unmanaged. This can be part of the same dll. you can use ppl.h/parallel_for from there. It will also be slightly faster than c++/cli. –  Nov 11 '12 at 14:12

1 Answers1

0

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.

Paul Michalik
  • 4,331
  • 16
  • 18
  • I'm really appreciate your answer. It worked me the way you said. I used TPL library inside managed components. Thank you. – user1815763 Nov 12 '12 at 10:37