0
我在目录CentOS的安装线程构建模块(http://threadingbuildingblocks.org/ver.php?fid=174)/家庭/ is_admin/tbb40_233oss/为什么这个tbb程序无法编译?
这是我的代码:
#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的经验可以帮助我吗?
你的意思是我必须使用concurrent_bounded_queue的代码是threadingbuildingblocks.org HTTP的示例代码:// cache.www.intel.com/cd/00/00/30/11/301114_301114.pdf#page=61 – Treper 2012-04-19 06:15:41
嗯,我可能错过了一些东西。我给出的答案是'tbb :: strict_ppl :: concurrent_queue',这是你的编译器认为'concurrent_queue'引用的内容。看起来像另一个'concurrent_queue'类具有不同的接口。 – 2012-04-19 06:21:03
@Greper:您链接的文档来自2007年。有更新的文档[此处](http://threadingbuildingblocks.org/documentation.php)。 – 2012-04-19 06:24:42