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

getting errors while using tbb library

Ajay_S_
Beginner
377 Views

hello ,
I have built a library(say MYLIB) in which i have used tbb to paralleize. This  MYLIB i am trying to use for one application i am building and when i try to build the application getting following erros :

/usr/include/tbb/internal/_concurrent_unordered_impl.h:146:85: error:   expected a type, got ‘397’
/usr/include/tbb/internal/_concurrent_unordered_impl.h:146:85: error: template argument 2 is invalid
/usr/include/tbb/internal/_concurrent_unordered_impl.h:146:90: error: ‘bool tbb::interface5::internal::operator!=(const int&, const int&)’ must have an argument of class or enumerated type
     friend bool operator!=( const solist_iterator<M,T>& i, const solist_iterator<M,U>& j );

can anyone please help , i am new to tbb .

0 Kudos
4 Replies
Christophe_H_Intel
377 Views

Hi, Ajay,

When I have seen this kind of message it is usually because a preprocessor symbol has collided with a typename or variable name.  Do you have M, T or U predefined somewhere?

 

Best Regards,

Chris

0 Kudos
Ajay_S_
Beginner
377 Views

Hi Mr. Chris
Many Thanks for your kind reply .
Yeah I do had a macro M declared.. :)

0 Kudos
RafSchietekat
Valued Contributor III
377 Views

Always use a distinctive prefix, or otherwise carefully #undef after local use, and only use macros for things that cannot be done in the underlying language itself (C++ already has provisions for constants and inline function templates etc.).

Unfortunately that simplistic preprocessor is all we have for light-weight code generation, so you have to be quite careful how you use it. People already get hysterical about macros even when you use them responsibly (in my view), so it's best not to give them any reasons.

 

 

0 Kudos
Ajay_S_
Beginner
377 Views

Thanks a lot Mr. Raf and Christopher for your prompt suggestions ,
that solved the problem for me :)

0 Kudos
Reply