Friday, 31 August 2012

Try protojs serials : B. support C++

I will develop a web site using C++. I need a compiler for generating C++ codes from group.proto file.
A standard protocol buffer from google will be installed. I didn't describe how to install this here. Please refer to the official site:
http://code.google.com/p/protobuf/

Create a build.sh file under proto folder. Add some scripts into it.


rm output/js/*
rm output/c++/*
protoc --proto_path=./input --cpp_out=./output/c++ ./input/group.proto
pbj input/group.proto output/js/group.js

chmod +x ./build.sh

Now execute build.sh, you will see C++ and JavaScript files are both generated.

proto/
├── build.sh
├── input
│   └── group.proto
└── output
    ├── c++
    │   ├── group.pb.cc
    │   └── group.pb.h
    └── js
        └── group.js

4 directories, 5 files

No comments:

Followers

Contributors