Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!

Compilation error while using tbb library

Ajay_S_
Beginner
478 Views

Hello ,
Warm greetings!

I am stuck at following compilation issue :

In file included from /usr/include/tbb/concurrent_hash_map.h:32:0,

                 from ../../../src/linkedlists/lockfree-list/BTO.h:10,
                 from ../../../src/linkedlists/lockfree-list/BTO.cpp:9,
                 from ../../../src/linkedlists/lockfree-list/intset.c:13:
/usr/include/tbb/tbb_stddef.h:121:56: fatal error: cstddef: No such file or directory
 #include <cstddef>      /* Need size_t and ptrdiff_t */

can someone please share how i can fix this.

PS : on the other hand the same tbb library works fine if i write another simple application using tbb.

 

0 Kudos
6 Replies
Alexandr_K_Intel1
478 Views
Ajay, Which compiler and OS are you using?
Ajay_S_
Beginner
478 Views

I am Using Ubuntu 14.04 , and GCC.

Vladimir_P_Intel2
478 Views

hello

do you use gcc or g++ to compile your code?

from the log I see that you are compiling intset.c "C" file where you include C++ file (BTO.cpp). so the error looks that C compiler does not see C++ headers because it shouldn't.

try to rename intset.c to intset.cpp

--Vladimir

Ajay_S_
Beginner
478 Views

Hi Vladimir

I was using g++ to compile intset.c, changing the name to intset.cpp solved the problem for me :).
may i request you , if you can elaborate why C++ header were not seen , eventhough i was using g++?

many thanks  Alexandr and Vladimir for your kind help.

Vladimir_P_Intel2
478 Views

Ajay S. wrote:

may i request you , if you can elaborate why C++ header were not seen , eventhough i was using g++?

This is a question for StackOverflow, not for tbb forum:)

I think by this behaviour compilers are trying to guard developers from stupid errors related to mixing C and C++ code.

--Vladimir

RafSchietekat
Black Belt
478 Views

https://gcc.gnu.org/onlinedocs/gcc/Invoking-G_002b_002b.html:

"g++ is a program that calls GCC and automatically specifies linking against the C++ library. It treats ‘.c’, ‘.h’ and ‘.i’ files as C++ source files instead of C source files unless -x is used."

Hmm...

Reply