Reputation: 109
I'm trying to build some dll to wrap some Computer Vision methods in a c++ software to use them a c# software, and I need to call some tbb (Threading Building Blocks) methods from the c++ methods to process some frame. I'm developing in CLR using Charset Unicode, in visual studio, and once I call the tbb header
#include <tbb/tbb.h>
The compiler give me the error:
error C2711: 'tbb::internal::concurrent_vector_base_v3::concurrent_vector_base_v3' try use #pragma unmanaged;
I've correctly imported and linked libraries and headers files, and the required dlls. I've looked for some helps on Intel's forums but I found nothing.
Upvotes: 0
Views: 402
Reputation: 11220
This sounds like you're trying to build an application using CLR, but it doesn't like some of the code in tbb
's header. Error C2711 happens when trying to compile code as managed that it is unable to manage (for example, using inline assembly).
If you don't need CLR, you should just be able to disable it (remove /clr
) -- which should fix this warning. Otherwise, you can use #pragma unmanaged
as recommended in the warning to disable it -- I'm guessing before the inclusion of the tbb/tbb.h
header. Something like:
#pragma managed(push, off)
#include <tbb/tbb.h>
#pragma managed(pop)
This should tell the project that any code in tbb.h
(such as potentially inline
functions that use assembly) should not emit IL.
Possibly related are some answers to this question which describes how interfacing with native code in CLR projects is commonly done
Upvotes: 3