title: undefined reference to google::protobuf in ROS CPP
body: <p>I am trying to use <a href="https://developers.google.com/protocol-buffers/" rel="nofollow noreferrer">Protocol Buffers</a> in ROS Indigo. It seems that there are problems in linking CPP source code. While compiling, it throws following errors:</p>
  
  <pre><code>Linking CXX executable /home/ravi/ros_ws/devel/lib/protobuf_ros_tutorial/add_person
  CMakeFiles/add_person.dir/src/add_person.cc.o: In function `PromptForAddress(tutorial::Person*)':
  add_person.cc:(.text+0x6a): undefined reference to `google::protobuf::internal::fixed_address_empty_string'
  add_person.cc:(.text+0x1a5): undefined reference to `google::protobuf::internal::ArenaImpl::AllocateAlignedAndAddCleanup(unsigned long, void (*)(void*))'
  add_person.cc:(.text+0x1cc): undefined reference to `google::protobuf::internal::fixed_address_empty_string'
  add_person.cc:(.text+0x322): undefined reference to `google::protobuf::internal::fixed_address_empty_string'
  add_person.cc:(.text+0x454): undefined reference to `google::protobuf::util::TimeUtil::SecondsToTimestamp(long)'
  add_person.cc:(.text+0x496): undefined reference to `google::protobuf::Timestamp::CopyFrom(google::protobuf::Timestamp const&amp;)'
  add_person.cc:(.text+0x49e): undefined reference to `google::protobuf::Timestamp::~Timestamp()'
  add_person.cc:(.text+0x52c): undefined reference to `google::protobuf::internal::fixed_address_empty_string'
  </code></pre>
  
  <p>Below is the <code>CMakeLists.txt</code></p>
  
  <pre><code>cmake_minimum_required(VERSION 2.8.3)
  project(protobuf_ros_tutorial)
  
  set(CMAKE_CXX_FLAGS "-std=c++11  ${CMAKE_CXX_FLAGS}")
  
  find_package(catkin REQUIRED COMPONENTS
    roscpp
  )
  
  find_package(Protobuf REQUIRED)
  
  catkin_package(
  )
  
  include_directories(
    include
    ${catkin_INCLUDE_DIRS}
    ${PROTOBUF_INCLUDE_DIRS}
  )
  
  add_library(addressbook_protobuf include/addressbook.pb.cc)
  
  add_executable(add_person src/add_person.cc)
  
  target_link_libraries(
      add_person 
      ${catkin_LIBRARIES}
      addressbook_protobuf
      ${PROTOBUF_LIBRARIES}
  )
  </code></pre>
  
  <p>The <code>package.xml</code> is having default content as follows:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;package format="2"&gt;
    &lt;name&gt;protobuf_ros_tutorial&lt;/name&gt;
    &lt;version&gt;0.0.0&lt;/version&gt;
    &lt;description&gt;The protobuf_ros_tutorial package&lt;/description&gt;
  
    &lt;maintainer email="ravi@todo.todo"&gt;ravi&lt;/maintainer&gt;
    &lt;license&gt;TODO&lt;/license&gt;
    &lt;buildtool_depend&gt;catkin&lt;/buildtool_depend&gt;
    &lt;build_depend&gt;roscpp&lt;/build_depend&gt;
    &lt;build_export_depend&gt;roscpp&lt;/build_export_depend&gt;
    &lt;exec_depend&gt;roscpp&lt;/exec_depend&gt;
  
    &lt;export&gt;
    &lt;/export&gt;
  &lt;/package&gt;
  </code></pre>
  
  <p>Below is the file structure of the ROS package:</p>
  
  <pre><code>ravi@lab:~/ros_ws/src/protobuf_ros_tutorial$ ls -R
  .:
  CMakeLists.txt  include  package.xml  src
  
  ./include:
  addressbook.pb.cc  addressbook.pb.h  addressbook.proto
  
  ./src:
  add_person.cc
  </code></pre>
  
  <p>I am doubtful about the <code>CMakeLists.txt</code> file. Am I missing something?</p>