【问题标题】:How does thrift define nested structs?Thrift 如何定义嵌套结构?
【发布时间】:2021-05-31 19:48:12
【问题描述】:

例如,如何定义如下结构。

struct Model {
    1:list<Model> models;
}

这样的结构编译器会报错 Type "Model" has not been defined

【问题讨论】:

  • 请告诉我们错误。

标签: thrift


【解决方案1】:

完美运行,因为您使用的是最新版本,请参阅THRIFT-2421

$ ./thrift-0.9.1 -version
Thrift version 0.9.1

$ ./thrift-0.9.1 -gen cpp ./test.thrift
[ERROR:test.thrift:2] (last token was 'Model')
Type "Model" has not been defined.

$ ./thrift-0.10.0 -version
Thrift version 0.10.0

$ ./thrift-0.10.0 -gen cpp ./test.thrift

$

PS:撰写本文时的最新版本是 0.14.1。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-04-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-09-27
    • 1970-01-01
    • 2014-04-29
    相关资源
    最近更新 更多