I think this is just a matter of making sure the parent directory of dirA
and dirB is in your compiler's header search path. It should be possible to
just pass to the compiler -I*basedir* where *basedir* is the parent
directory of dirA and dirB.

On Fri, Jul 14, 2017 at 10:41 AM, Ronak Shah <ronak.sha...@gmail.com> wrote:

> Obviously if I were to edit the proto file for the include to:
>
> #include "a1.pb.h"
>
> it works fine.
>
>
> On Friday, July 14, 2017 at 10:39:11 AM UTC-7, Ronak Shah wrote:
>>
>> I have a directory hierarchy of protos, like:
>>
>> dirA/a1.proto
>> dirA/a2.proto
>>
>> dirB/b1.proto
>> dirB/b2.proto
>>
>> Using protoc, the generated C++ file has issues with including the header
>> a1.pb.h from its a1.pb.cc file.
>> Generated code in a1.pb.cc looks like:
>>
>> // Generated by the protocol buffer compiler.  DO NOT EDIT!
>>
>> // source: dirA/a1.proto
>>
>>
>> #define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
>>
>> #include "dirA/a1.pb.h"
>>
>>
>> #include <algorithm>
>>
>>
>> #include <google/protobuf/stubs/common.h>
>>
>> #include <google/protobuf/stubs/port.h>
>>
>> #include <google/protobuf/stubs/once.h>
>>
>> #include <google/protobuf/io/coded_stream.h>
>>
>> #include <google/protobuf/wire_format_lite_inl.h>
>>
>> #include <google/protobuf/descriptor.h>
>>
>> #include <google/protobuf/generated_message_reflection.h>
>>
>> #include <google/protobuf/reflection_ops.h>
>>
>> #include <google/protobuf/wire_format.h>
>>
>> ...
>>
>>
>> The compile error is:
>>
>> /.../project_dir/dirA/a1.pb.cc:5:10: 'dirA/a1.pb.h' file not found
>>
>>
>> Has anyone run into a similar problem? How would I go about to resolve
>> this issue?
>>
>>
>> Thanks!
>>
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to protobuf+unsubscr...@googlegroups.com.
> To post to this group, send email to protobuf@googlegroups.com.
> Visit this group at https://groups.google.com/group/protobuf.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to