Hi there,
I successfully compiled Cling on windows (VS 2017) and am just starting to play with it, I must say I’m starting to love it!
Now I would like to also use TBB in my project, so I created a simple app, in which I link tbb.lib.
The problem is as soon as I add the include (in my case #include “tbb\flow_graph.h”), I getting this error:
In file included from input_line_3:1:
In file included from C:\ThirdPartyLibs\tbb2018_20170919oss\include\tbb\flow_graph.h:24:
In file included from C:\ThirdPartyLibs\tbb2018_20170919oss\include\tbb/tbb_stddef.h:123:
C:\ThirdPartyLibs\tbb2018_20170919oss\include\tbb/internal/_tbb_windef.h:32:2: error: TBB requires linkage with multithreaded C/C++ runtime library. Choose multithreaded DLL runtime in project settings, or
use /MD[d] compiler switch. #error TBB requires linkage with multithreaded C/C++ runtime library. \
Hi, yes I did, So I tried 2 things, the first one was to load the tbb. lib +the headers in cling.exe,
then to create my own app with an interpreter and tbb.lib linked to that app:
Cling does not full support of Windows. That said, it looks like that’s the failing code
#if !defined(_MT)
#error TBB requires linkage with multithreaded C/C++ runtime library. \
Choose multithreaded DLL runtime in project settings, or use /MD[d] compiler switch.
#endif
This means that cling is not defining _MT in its runtime even though it was built with /MD. To implement the semantics of MD might be tricky we need also to load msvcrt according to documentation.
You could try two things. First try starting cling /MD and see if the runtime will define _MT. If that does not work you could force it to be defined in a similar to that manner.