1.下载erlang-protobuf 工程 路径 https://github.com/basho/erlang_protobuffs 之前找了一个src里面的不对。
2.工程里面有src 有 protobuffs_parser.yrl 和 protobuffs_scanner.xrl 两个文件需要编译成.erl文件
直接在cmd命令窗口进入src目录 运行 erlc protobuffs_parser.yrl protobuffs_scanner.xrl 就可以编译成对应名称的.erl文件
3.在src 同一级目录编写Emakefile 文件 里面
{'src/*',
[
debug_info,
{outdir,"ebin"}
}.
4.编译工程 cmd进入该目录里面执行 erl -make 即可编译成功。
5.在ebin文件下面就是生成的beam文件,可以放在一个person.proto 然后cmd里面进入该目录,执行erl 然后再执行
protobuffs_compile:generate_source("person.proto"). 会在当前目录下面生成person_pb.erl person_pb.hrl
或者执行 protobuffs_compile:scan_file("person.proto"). 会在当前目录下面生成person_pb.beam person_pb.hrl
这样生成的文件就可以供erlang使用。