Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

protoc各种参数生成的命名规则为什么那么奇怪? #56

Open
coreyzzp opened this issue Dec 2, 2018 · 0 comments
Open

protoc各种参数生成的命名规则为什么那么奇怪? #56

coreyzzp opened this issue Dec 2, 2018 · 0 comments

Comments

@coreyzzp
Copy link

coreyzzp commented Dec 2, 2018

下面尝试三种生成方式(全部都在 WORKDIR=~/dev-workspace/wx/phxrpc 下执行):

  1. third_party/protobuf/bin/protoc -Ithird_party/protobuf/include -I./phxrpc/rpc --cpp_out=. ./phxrpc/rpc/phxrpc.proto

最后生成的结果在 $WORKDIR 里面,与cpp_out参数指定的目标一致,然后phxrpc.pb.h的namespace为protobuf_phxrpc_2eproto

  1. third_party/protobuf/bin/protoc -Ithird_party/protobuf/include -I./phxrpc/rpc --cpp_out=./phxrpc/rpc ./phxrpc/rpc/phxrpc.proto

最后生成的结果在 $WORKDIR/phxrpc/rpc 里面,与cpp_out参数指定的目标一致,然后phxrpc.pb.h的namespace为protobuf_phxrpc_2eproto

  1. third_party/protobuf/bin/protoc -Ithird_party/protobuf/include -I. --cpp_out=. ./phxrpc/rpc/phxrpc.proto

最后生成的结果在 $WORKDIR/phxrpc/rpc 里面,与cpp_out参数指定的目标不一致 ,然后 phxrpc.pb.h的namespace为 protobuf_phxrpc_2frpc_2fphxrpc_2eproto

第三种就是官方提供的生成pb.cc的方式,这种方式生成的代码,在另外一个proto文件引用才是正常的,可视为什么呢?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant