2011-12-08 22 views
3

我是一个带Thrift的新手。我有以下问题: 假设我的文件“Ex1.thrift”定义的结构如下:如何使用关键字“包含”在Thrift文件中定义的结构

namespace java tut1 
struct Address { 
1:string nameStreet, 
2:i32 idHouse 
} 

我想在文件“Ex2.thrift”使用结构地址,我怎么能做到这一点? 我想这样,但节俭的编译器不工作:

include "Ex1.thrift" 
namespace java tut2 
struct Student { 
1:string name, 
2:i32 age, 
3:Address add 
} 

service ExampleService { 
list<Student> getListStudent() 
} 

非常感谢你的任何答复。

回答

11

您需要同时Ex2.thrift

使用地址
include "Ex1.thrift" 
    namespace java tut2 
    struct Student { 
    1:string name, 
    2:i32 age, 
    3:Ex1.Address add 
    } 

    service ExampleService { 
    list<Student> getListStudent() 
    } 

这个作品在节俭提供练习1前缀0.8.0

相关问题