Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.
2421 Discussions

Ambiguous symbols with boost::int64_t and __int64 tbb::internal::int64_t

New Contributor I

I'm using Boost & TBB together, and I ran into an ambiguous symbol error compiling with VS2008. It shows up in tbb_machine.h in the version of TBB at line 595. The offending code is here:

#if _MSC_VER
using tbb::internal::int64_t;
// On 32-bit platforms, there should be definition of __TBB_Store8 and __TBB_Load8
#ifndef __TBB_Store8
inline void __TBB_Store8 (volatile void *ptr, int64_t value) {
for(;;) {
int64_t result = *(int64_t *)ptr;
if( __TBB_CompareAndSwap8(ptr,value,result)==result ) break;

#ifndef __TBB_Load8
inline int64_t __TBB_Load8 (const volatile void *ptr) {
const int64_t anyvalue = 3264; // Could be anything, just the same for comparand and new value
return __TBB_CompareAndSwap8(const_cast(ptr),anyvalue,anyvalue);

struct __TBB_machine_load_store {
static inline T load_with_acquire(const volatile T& location) {
T to_return = (T)__TBB_Load8((const volatile void*)&location);
return to_return;

static inline void store_with_release(volatile T& location, T value) {
__TBB_Store8((volatile void *)&location,(int64_t)value);
#endif /* __TBB_WORDSIZE==4 */

The ambiguous symbol is the int64_t in the __TBB_Store8((volatile void *)&location,(int64_t)value); call. I tracked it back to an unnecessary "using namespace boost;" up in a header. Removing that worked, but looking at the code, the #if _MSC_VER should pull in an unambiguous type, but it doesn't. You can hack around it with something like:

#if _MSC_VER
using tbb::internal::int64_t;
typedef tbb::internal::int64_t int64_tt;
typedef int64_t int64_tt;

and changing the call to __TBB_Store8((volatile void *)&location,(int64_tt)value);

to make it specific if you have to have boost types in the namespace, but, it's a hack. It's kind of a corner case, but I thought I should point it out.


0 Kudos
0 Replies