我在 centos 目录 /home/is_admin/tbb40_233oss/ 中安装线程构建块(http://threadingbuildingblocks.org/ver.php?fid=174)
这是我的代码:
#include "tbb/concurrent_queue.h"
#include <iostream>
using namespace std;
using namespace tbb;
int main() {
concurrent_queue<int> queue;
for( int i=0; i<10; ++i )
queue.push(i);
for( concurrent_queue<int>::const_iterator i(queue.begin());
i!=queue.end(); ++i )
cout << *i << " ";
cout << endl;
return 0;
}
我使用以下命令编译代码:
g++ test_concurrent_queue.cpp -I/home/is_admin/tbb40_233od/linux_intel64_gcc_cc4.1.2_libc2.5_kernel2.6.18_release -ltbb -o tcq
但它给出了这个错误:
class tbb::strict_ppl::concurrent_queue<int, tbb::cache_aligned_allocator<int> > has no member named begin
class tbb::strict_ppl::concurrent_queue<int, tbb::cache_aligned_allocator<int> > has no member named end
我不知道为什么?任何有tbb经验的人可以帮助我吗?