title: How to compile Google Protobuf command line interface compile
body: <p>I am trying to raw decode a protobuf binary. I installed the google protobuf library from the source code <a href="https://github.com/google/protobuf" rel="nofollow noreferrer">https://github.com/google/protobuf</a>
  I am able to use the command line to decode raw a protobuf binary using the command <code>protoc --decode_raw &lt;encodedfile&gt;</code>. I want to be able to do this programmatically using the c++ library. Something similar to the following example in the documentation. </p>
  
  <p><a href="https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.compiler.command_line_interface" rel="nofollow noreferrer">https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.compiler.command_line_interface</a></p>
  
  <p>However trying to compile a simple piece of code does not work. </p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;string&gt;
  #include &lt;google/protobuf/compiler/command_line_interface.h&gt;
  using namespace google::protobuf::compiler;
  using namespace std;
  
  int main(int argc, char* argv[]) {
  
  
      google::protobuf::compiler::CommandLineInterface cli_;
      cerr &lt;&lt; "Compiled And Run" &lt;&lt; endl;
  
  }
  </code></pre>
  
  <p>Compile command</p>
  
  <pre><code>c++  my_program.cc  -o my_program -pthread -I/usr/local/include  -pthread -L/usr/local/lib -lprotobuf -lpthread
  </code></pre>
  
  <p>I see the following error</p>
  
  <pre><code>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()'
  </code></pre>
  
  <p>Appreciate any help with this. </p>