创建它并用try 和catch 包围。阅读文档以查找 already_exists (或类似内容)的错误代码(针对您特定版本的 boost)
查看Boost 1.55 doc 以获取该版本中的示例
具体看一下链接代码:
namespace boost {
namespace interprocess {
enum error_code_t { no_error = = 0, system_error, other_error,
security_error, read_only_error, io_error, path_error,
not_found_error, busy_error, already_exists_error,
not_empty_error, is_directory_error,
out_of_space_error, out_of_memory_error,
out_of_resource_error, lock_error, sem_error,
mode_error, size_error, corrupted_error,
not_such_file_or_directory, invalid_argument,
timeout_when_locking_error,
timeout_when_waiting_error };
typedef int native_error_t;
}
}
有一个
already_exists_error