I’m trying to learn how to use ppl.h in c++ . But I’m not sure what kind of solution I should create in VS2010 to use it. If i create a Win32 Console app without CLR’concurrency’ is not recognized and if i create Win32 Console app with CLR i get an error saying
Concurrency Runtime is not supported when compiling /clr.
#include "stdafx.h"
#include <ppl.h>
using namespace System;
void BubbleSort(int* input, int n)
{
concurrency::parallel_for(0,n,[=](int y)
{
for(int k = 0; k< n - 1 -y; k++)
{
if(input[k]> input[k+1])
{
auto temp = input[k+1];
input[k+1] = input[k];
input[k] = temp;
}
}
}
}
int main(array<System::String ^> ^args)
{
Console::WriteLine(L"Hello World");
return 0;
}
You can make a Win32 Console Application (no CLR). Once you
#include <ppl.h>, theConcurrencynamespace should be available. Note that it’sConcurrency::parallel_for(captial “C”).For details, see the PPL example on MSDN.