gpt4 book ai didi

c++ - 使用英特尔线程构建模块 : error operands to ? 进行编译:

转载 作者:行者123 更新时间:2023-11-30 05:07:00 36 4
gpt4 key购买 nike

目前,我尝试编译 OpenVDB,它依赖于 Threading Building Blocks。我收到以下错误:

In file included from /usr/include/tbb/enumerable_thread_specific.h:32:0,
from ../openvdb/tools/Morphology.h:59,
from ../openvdb/tools/MultiResGrid.h:64,
from cmd/openvdb_lod/main.cc:32:
/usr/include/tbb/concurrent_vector.h: In member function ‘tbb::concurrent_vector<T, A>::iterator tbb::concurrent_vector<T, A>::grow_by(tbb::concurrent_vector<T, A>::size_type)’:
/usr/include/tbb/concurrent_vector.h:667:38: error: operands to ?: have different types ‘tbb::internal::concurrent_vector_base_v3::size_type {aka long unsigned int}’ and ‘tbb::atomic<long unsigned int>’
return iterator(*this, delta ? internal_grow_by( delta, sizeof(T), &initialize_array, NULL ) : my_early_size);
~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/tbb/concurrent_vector.h:667:38: note: and each type can be converted to the other
/usr/include/tbb/concurrent_vector.h: In member function ‘tbb::concurrent_vector<T, A>::iterator tbb::concurrent_vector<T, A>::grow_by(tbb::concurrent_vector<T, A>::size_type, tbb::concurrent_vector<T, A>::const_reference)’:
/usr/include/tbb/concurrent_vector.h:680:38: error: operands to ?: have different types ‘tbb::internal::concurrent_vector_base_v3::size_type {aka long unsigned int}’ and ‘tbb::atomic<long unsigned int>’
return iterator(*this, delta ? internal_grow_by( delta, sizeof(T), &initialize_array_by, static_cast<const void*>(&t) ) : my_early_size);
~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/tbb/concurrent_vector.h:680:38: note: and each type can be converted to the other
make: *** [vdb_lod] Error 1

简而言之,作为第二个和第三个参数,?: 运算符获得一个基类型和包含在 tbb::atomic 中的相同基类型,编译器不知道使用哪种类型作为返回值(value)。

不用说,我无意更改该源代码。由于它们是成熟的产品,可以肯定地说我在编译时做错了。

TBB 库文件似乎是使用相当旧版本的 GCC 构建的,即 4.7。本来以为问题出在我用的是GCC 7.2.0,于是尝试了不同的版本,比如GCC 4.8.5,还是报错。

我没有特别尝试过 4.7,因为我在一家没有管理员权限的公司工作,而且我尽量避免在本地安装 GCC。特别是因为我不知道 GCC 是否是这里的问题。

有人知道解决办法吗?

编辑:https://software.intel.com/en-us/forums/intel-threading-building-blocks/topic/417161似乎是关于同样的问题,英特尔的一名员工注意到它在那里进行了更改。然而,那篇文章是 2013 年的,因为人们在这期间使用了 TBB,所以我做的事情肯定有所不同。

最佳答案

看起来使用的是过时的 TBB 版本。参见 the similar question on the TBB forum .

关于c++ - 使用英特尔线程构建模块 : error operands to ? 进行编译:,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47673311/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com