I have two types "Company" and "User" both including a common type "Address", and am trying to generate cpp header files. I tried multiple ways, but I end up having "Address" struct being multiply defined in two different header files. Can avrogencpp generate one header for each type instead of having everything in one single file?
This is as far as I could go:
1) Created sample.avdl
@namespace("test")
protocol Simple {
record Address {
string street;
string state;
string zip;
}
record Company {
string name;
Address address;
}
record Employee {
string firstName;
string lastName;
Address address;
}
}
2) Used avro-tools to generate schema files: avro-tools idl2schemata sample.avdl
3) Used avrogencpp to generate headers:
avrogencpp -i Address.avsc -o address.h
avrogencpp -i Employee.avsc -o employee.h
avrogencpp -i Company.avsc -o company.h
Now, the problem is both employee.h and company.h multiply define struct Address
and hence unable to compile together.