找回密码
 立即注册
查看: 243|回复: 0

go怎么根据proto编译出bp文件

[复制链接]
发表于 2022-11-28 17:09 | 显示全部楼层 |阅读模式
安装protobuf
在前提条件中,需要安装libtool
sudo yum install libtool
然后安装过程中需要c++11,需要升级gcc的版本到4.7以上
以下目录下已预集成不同gcc的版本cd /opt/compiler/export PATH=/opt/compiler/gcc-8.2/bin:$PATHexport LIBRARY_PATH=/opt/compiler/gcc-8.2/lib64/:$LIBRARY_PATH
然后遇到问题:
protoc-gen-go: program not found or is not executable--go_out: protoc-gen-go: Plugin failed with status code 1.gen.go:10: running "protoc": exit status 1
解决方案:
https://blog.csdn.net/qq_38639426/article/details/107669849

然后编译proto的文件:
package pack// To run these commands, make sure that protoc-gen-go and protoc-gen-go-grpc are installed// > go install google.golang.org/protobuf/cmd/protoc-gen-go// > go install google.golang.org/grpc/cmd/protoc-gen-go-grpc//// Generated files were last generated with:// - protoc-gen-go: v1.27.1// - protoc-gen-go-grpc: v1.1.0//go:generate protoc --go_out=proto所在目录/ --go-grpc_out=proto所在目录/ proto所在目录/proto_test.proto
编译方式:
go generate ./...
懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Unity开发者联盟 ( 粤ICP备20003399号 )

GMT+8, 2024-11-24 16:21 , Processed in 0.087667 second(s), 25 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表