Problems compiling with concurrent_queue

Problems compiling with concurrent_queue

carlosrene's picture

I've been stuck for a while trying to compile a trivial concurrent_queue, hopefully somebody could point out where I faltered.


gcc (Gentoo 4.3.2 p1.1) 4.3.2 Linux 2.6.29 tbb22_20090908oss (have also triedtbb22_004oss andtbb22_20090809oss) g++ -g -o test-tbb test-tbb.cpp -DTBB_DO_ASSERT -MMD -DDO_ITT_NOTIFY -O0 -DUSE_PTHREAD -m64 -Wall -I../libs/tbb22/include/ -L ../libs/tbb22/lib_debug -ltbb_debug -lpthread -lrt /* file: test-tbb.cpp */ #include #include using namespace std; using namespace tbb; int main() { concurrent_queue queue; queue.set_capacity(10); for(int i=0; i < 10; ++i) queue.push(i); int ret; while(!queue.empty()) { queue.pop_if_present(ret); cout << ret << " "; } cout << endl; return 0; } /* this is the g++ error I get at compile-time */ test-tbb.cpp: In function int main(): test-tbb.cpp:9: error: class tbb::strict_ppl::concurrent_queue > has no member named set_capacity test-tbb.cpp:16: error: class tbb::strict_ppl::concurrent_queue > has no member named pop_if_present make: *** [test-tbb] Error 1 1. I don't know what namespace strict_ppl is, on the Reference Manual it says that this namespace is used when in tbb/compat.ppl.h is included. 2. I keep looking at the doxygen and the method name does exists. Could I be using the wrong version of class concurrent_queue<>? 3. The include is set correctly, since tbb only has one directory -there is no ambiguity-. Appreciate any help, I'm sure I'm overlooking something...
2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
Terry Wilmarth (Intel)'s picture
Best Reply
Quoting - carlosrene I've been stuck for a while trying to compile a trivial concurrent_queue, hopefully somebody could point out where I faltered.
gcc (Gentoo 4.3.2 p1.1) 4.3.2 Linux 2.6.29 tbb22_20090908oss (have also triedtbb22_004oss andtbb22_20090809oss) g++ -g -o test-tbb test-tbb.cpp -DTBB_DO_ASSERT -MMD -DDO_ITT_NOTIFY -O0 -DUSE_PTHREAD -m64 -Wall -I../libs/tbb22/include/ -L ../libs/tbb22/lib_debug -ltbb_debug -lpthread -lrt /* file: test-tbb.cpp */ #include #include using namespace std; using namespace tbb; int main() { concurrent_queue queue; queue.set_capacity(10); for(int i=0; i < 10; ++i) queue.push(i); int ret; while(!queue.empty()) { queue.pop_if_present(ret); cout << ret << " "; } cout << endl; return 0; } /* this is the g++ error I get at compile-time */ test-tbb.cpp: In function int main(): test-tbb.cpp:9: error: class tbb::strict_ppl::concurrent_queue > has no member named set_capacity test-tbb.cpp:16: error: class tbb::strict_ppl::concurrent_queue > has no member named pop_if_present make: *** [test-tbb] Error 1 1. I don't know what namespace strict_ppl is, on the Reference Manual it says that this namespace is used when in tbb/compat.ppl.h is included. 2. I keep looking at the doxygen and the method name does exists. Could I be using the wrong version of class concurrent_queue<>? 3. The include is set correctly, since tbb only has one directory -there is no ambiguity-. Appreciate any help, I'm sure I'm overlooking something...

Hi,
It looks like you are using TBB 2.2, but your code looks like the 2.1 API. Some small API changes were made between 2.1 and 2.2. You should double-check the latest documentation for the new use of concurrent_queue. My blog here has a quick summary of the changes.

Cheers,
Terry

Login to leave a comment.