title: Can't build test C++ app with Google's protobuf
body: <p>I'm trying to build sample C++ protobuf application with CMake. But linker can't find some methods related to protobuf.</p>
  
  <p>I use example .proto file from <a href="https://developers.google.com/protocol-buffers/docs/cpptutorial#where-to-find-the-example-code" rel="nofollow">developers guide</a>. But when linker try to build object file for protobuf generated C++ code I have a lot of errors like this:</p>
  
  <pre><code>undefined reference to `google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(int, std::string const&amp;, google::protobuf::io::CodedOutputStream*)'
  undefined reference to `google::protobuf::io::CodedOutputStream::WriteStringWithSizeToArray(std::string const&amp;, unsigned char*)'
  undefined reference to `google::protobuf::internal::empty_string_'
  undefined reference to `google::protobuf::internal::InitEmptyString()'
  undefined reference to `google::protobuf::internal::empty_string_once_init_'
  undefined reference to `google::protobuf::internal::WireFormat::VerifyUTF8StringFallback(char const*, int, google::protobuf::internal::WireFormat::Operation, char const*)'
  </code></pre>
  
  <p>I use protobuf 2.6.1 built myself with GCC 4.8.4. Sample application is built by CMake in QTCreator with QT 5.5.1 Toolset and GCC 4.8.4. There is my CMakeList.txt</p>
  
  <pre><code>project(protobuf-test)
  cmake_minimum_required(VERSION 2.8)
  aux_source_directory(. SRC_LIST)
  add_executable(${PROJECT_NAME} ${SRC_LIST})
  LINK_DIRECTORIES(/usr/lib)
  TARGET_LINK_LIBRARIES(${PROJECT_NAME} pthread protobuf)
  </code></pre>
  
  <p>Thanks for help!</p>