title: C++ Converting protobuf in json
body: <p>I'am trying to connect some data from protobuf to json.</p>
  
  <p>This are the relevants parts of my code:</p>
  
  <pre><code>Message* m;
  std::string json;
  std::string binary_s;
  ...fill the message...
  m-&gt;serializeToString(&amp;binary_s);
  MessageToJsonString(*m, &amp;json);
  </code></pre>
  
  <p>The istruction below works fine and produced the expected output. </p>
  
  <pre><code>m-&gt;serializeToString(&amp;binary_s); 
  </code></pre>
  
  <p>But when I try to convert it into json, this error always appear:</p>
  
  <pre><code>Program received signal SIGSEGV, Segmentation fault.
  google::protobuf::DescriptorPool::FindFileByName (this=0x0,     name="FLATBUFFER_DEFINITION.proto") at google/protobuf/descriptor.cc:1415
  1415      MutexLockMaybe lock(mutex_);
  (gdb) backtrace
  #0  google::protobuf::DescriptorPool::FindFileByName (this=0x0,     name="AutoPilot.proto")
      at google/protobuf/descriptor.cc:1415
  #1  0x00007ffff7aba42d in google::protobuf::internal::AssignDescriptors     (filename="AutoPilot.proto", 
      schemas=0x4463a0 &lt;protobuf_AutoPilot_2eproto::schemas&gt;, 
      default_instances_=0x446500     &lt;protobuf_AutoPilot_2eproto::file_default_instances&gt;, 
      offsets=0x445c20 &lt;protobuf_AutoPilot_2eproto::TableStruct::offsets&gt;, factory=0x0, 
      file_level_metadata=0x665020 &lt;protobuf_AutoPilot_2eproto::file_level_metadata&gt;, 
      file_level_enum_descriptors=0x6651e0 &lt;protobuf_AutoPilot_2eproto::file_level_enum_descriptors&gt;, 
      file_level_service_descriptors=0x0) at google/protobuf    /generated_message_reflection.cc:2316
  #2  0x000000000040730c in         protobuf_AutoPilot_2eproto::protobuf_AssignDescriptors() ()
  #3  0x00007ffff7a24bd5 in google::protobuf::internal::FunctionClosure0::Run (this=0x7fffffffda90)
      at ./google/protobuf/stubs/callback.h:129
  #4  google::protobuf::GoogleOnceInitImpl (
  once=0x665388     &lt;protobuf_AutoPilot_2eproto::protobuf_AssignDescriptorsOnce()::once&gt;,     closure=0x7fffffffda90)
      at google/protobuf/stubs/once.cc:83
  #5  0x0000000000433abb in google::protobuf::GoogleOnceInit(long*, void     (*)()) ()
  #6  0x0000000000407383 in protobuf_AutoPilot_2eproto::protobuf_AssignDescriptorsOnce() ()
  #7  0x0000000000431503 in Message::GetMetadata() const ()
  #8  0x00007ffff7b536cc in google::protobuf::Message::GetDescriptor (this=0x68e0b0) at ./google/protobuf/message.h:336
  #9  google::protobuf::util::MessageToJsonString (message=warning: RTTI     symbol not found for class 'Message'
  ..., output=0x7fffffffdd60, options=...)
      at google/protobuf/util/json_util.cc:217
  </code></pre>
  
  <p>It seems like it can't find the file  "FLATBUFFER_DEFINITION.proto", but it is in the same directory of the executable.</p>