Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.

Errors when compiling c code with tbb headers

Erez_Zilber
Beginner
651 Views
Hi,

My project contains only C code on Linux. I've added the following line to a C file:

[bash]#include "tbb/atomic.h"[/bash] Then, I got the following error during compilation:

[bash]/opt/intel/tbb/include/tbb/atomic.h(24): catastrophic error: cannot open source file "cstddef" #include [/bash] I switched to icpc and recompiled, but now I get this:

[bash]/opt/intel/tbb/include/tbb/tbb_stddef.h(95): error #193: zero used for undefined preprocessing identifier "_WIN32" #if _WIN32||_WIN64 ^ /opt/intel/tbb/include/tbb/tbb_stddef.h(95): error #193: zero used for undefined preprocessing identifier "_WIN64" #if _WIN32||_WIN64 ^ /opt/intel/tbb/include/tbb/tbb_config.h(33): error #193: zero used for undefined preprocessing identifier "__clang__" #if __clang__ ^ /opt/intel/tbb/include/tbb/tbb_config.h(79): error #193: zero used for undefined preprocessing identifier "__MINGW32__" #if __MINGW32__ && __TBB_EXCEPTION_PTR_PRESENT && !defined(_GLIBCXX_ATOMIC_BUILTINS_4) ^ /opt/intel/tbb/include/tbb/tbb_config.h(134): error #193: zero used for undefined preprocessing identifier "__MIC__" #if __MIC__ || __MIC2__ ^ /opt/intel/tbb/include/tbb/tbb_config.h(134): error #193: zero used for undefined preprocessing identifier "__MIC2__" #if __MIC__ || __MIC2__ ^ /opt/intel/tbb/include/tbb/tbb_config.h(145): error #193: zero used for undefined preprocessing identifier "__TBB_DEFINE_MIC" #if __TBB_DEFINE_MIC ^ [/bash] Can anyone help with this?

BTW - before compiling, I ran the following commands in order to set the environment:

[bash]source /opt/intel/bin/compilervars.sh intel64 source /opt/intel/tbb/bin/tbbvars.sh intel64[/bash]
Thanks,
Erez
0 Kudos
1 Reply
Anton_M_Intel
Employee
651 Views
TBB is C++ library. It does not support plain C excepting TBB allocator which has such a support.
0 Kudos
Reply