kidok / protobuf

Automatically exported from code.google.com/p/protobuf
0 stars 0 forks source link

Header file path is wrong in generated .cc files for .proto files in inner directories #634

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create two or more .proto files in the following manner
PWD = current
./current - a.proto
./current/dir1 - b.proto
2. From current directory execute protoc 
protoc --cpp_out=. a.proto dir1/b.proto
3. Check #include in generated .cc files

a.pb.cc -> #include "a.h"
dir1/b.pb.cc -> #include "dir1/b.pb.h"

What is the expected output? What do you see instead?

Expected output is, for dir1/b.pb.cc, #include should contain just "b.pb.h" and 
not "dir1/b.pb.h".
This is because b.ph.h is co-located with b.pb.cc in dir1 itself. But because 
#include has "dir1/b.ph.h", b.pb.cc doesn't get compiled. 

What version of the product are you using? On what operating system?

libprotoc 2.5.0 / MAC OS x 10.9.2

Please provide any additional information below.

Original issue reported on code.google.com by ajo...@definitionnetworks.com on 1 May 2014 at 10:56

GoogleCodeExporter commented 9 years ago
I don't think this is wrong. Protobuf is generating full path, which imo is a 
good thing.

How are you compiling b.pb.cc?

Original comment by tfar...@chromium.org on 22 May 2014 at 7:01

GoogleCodeExporter commented 9 years ago
This is by design.

If you want the generated code to include "b.pb.h", you should invoke protoc 
like this:
protoc --cpp_out=. -Idir1 dir1/b.proto

Original comment by xiaof...@google.com on 22 May 2014 at 5:26