Using ConcRT in C ++ / CLI is explicitly disabled in concrt.h using the instructions below because it is not officially supported ...
#if defined(_M_CEE) #error ERROR: Concurrency Runtime is not supported when compiling /clr. #endif
You can use PInvoke to get around this, as suggested above, or you can also use the pointer to the implementation idiom to address this by redirecting the "pimpl" class and hide the dependency on concrt.h to your own .cpp file which you can then compile in lib and the link against the header file.
eg. in the .h file:
//forward declaration class PImpl; class MyClass { .... //forward declaration is sufficient because this is a pointer PImpl* m_pImpl; }
eg. in your .cpp file that compiles to your own lib:
#include <ppl.h> class PImpl { //some concrt class Concurrency::task_group m_tasks; }
source share