【发布时间】:2020-07-20 02:26:06
【问题描述】:
我正在尝试编译一些 boost 代码,但出现以下错误
这是代码的简化版
#include <boost/interprocess/managed_shared_memory.hpp>
using namespace boost::interprocess;
int main()
{
managed_shared_memory shmem(create_only, "MySharedMemory", sizeof(TransferData));
mapped_region region(shmem, read_write);
}
但我遇到了这个问题
In file included from holster/src/main.cc:6:
In file included from external/boost/boost/interprocess/managed_shared_memory.hpp:26:
In file included from external/boost/boost/interprocess/detail/managed_open_or_create_impl.hpp:26:
external/boost/boost/interprocess/mapped_region.hpp:594:39: error: no member named 'get_mapping_handle' in 'boost::interprocess::basic_managed_shared_memory<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, int, unsigned int, 0>, 0>, iset_index>'
mapping_handle_t map_hnd = mapping.get_mapping_handle();
~~~~~~~ ^
holster/src/main.cc:96:21: note: in instantiation of function template specialization 'boost::interprocess::mapped_region::mapped_region<boost::interprocess::basic_managed_shared_memory<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, int, unsigned int, 0>, 0>, iset_index> >' requested here
mapped_region region(shmem, read_write, 1000);
^
In file included from holster/src/main.cc:6:
In file included from external/boost/boost/interprocess/managed_shared_memory.hpp:26:
In file included from external/boost/boost/interprocess/detail/managed_open_or_create_impl.hpp:26:
external/boost/boost/interprocess/mapped_region.hpp:702:32: error: no member named 'get_mapping_handle' in 'boost::interprocess::basic_managed_shared_memory<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, int, unsigned int, 0>, 0>, iset_index>'
, mapping.get_mapping_handle().handle
~~~~~~~ ^
这是我正在使用的 boost 版本
Version: 1.71.0.0ubuntu2
【问题讨论】: