【问题标题】:How to access variables across namespaces in thrift如何在 Thrift 中跨命名空间访问变量
【发布时间】:2026-02-20 17:25:01
【问题描述】:

假设我有两个文件

Something.thrift

namespace cpp something
struct Something { ... }

Marvelous.thrift

include "Something.thrift"
namespace cpp marvelous
struct IncludingSomething {
    1: required something::Something;
}

这里无法识别范围解析运算符,如何从Marvelous.thrift访问Something

【问题讨论】:

标签: c++ namespaces thrift


【解决方案1】:

使用dot 运算符。就这样

include "Something.thrift"
namespace cpp marvelous
struct IncludingSomething {
    1: required something.Something;
}

【讨论】: