0
私はprotobufバイナリを生デコードしようとしています。 https://github.com/google/protobuf 私は、コマンドprotoc --decode_raw <encodedfile>
を使って、protobufバイナリをデコードするためにコマンドラインを使用することができます。私はこれをプログラムでC++ライブラリを使ってやりたいと思っています。ドキュメントの次の例に似た何か。GoogleのProtobufコマンドラインインターフェイスをコンパイルする方法
しかし、コードのシンプルな作品が動作しませんコンパイルしようとしています。
#include <iostream>
#include <fstream>
#include <string>
#include <google/protobuf/compiler/command_line_interface.h>
using namespace google::protobuf::compiler;
using namespace std;
int main(int argc, char* argv[]) {
google::protobuf::compiler::CommandLineInterface cli_;
cerr << "Compiled And Run" << endl;
}
c++ my_program.cc -o my_program -pthread -I/usr/local/include -pthread -L/usr/local/lib -lprotobuf -lpthread
コマンドをコンパイルし、私は次のエラー
my_program.cc:(.text+0x24): undefined reference to `google::protobuf::compiler::CommandLineInterface::CommandLineInterface()'
my_program.cc:(.text+0x4f): undefined reference to `google::protobuf::compiler::CommandLineInterface::~CommandLineInterface()'
my_program.cc:(.text+0x70): undefined reference to `google::protobuf::compiler::CommandLineInterface::~CommandLineInterface()'
はこれで任意の助けに感謝ご覧ください。
protobufライブラリを作成しましたか? [ここ](https://github.com/google/protobuf/tree/master/src)の手順を使用してください。 – Steeve