title: How to resolve "sizeof" error while using boost:serialization in c++?
body: <p>I'm using boost::serialization, following is my class and I tried to serialize this class object in the main function.</p>
  
  <pre><code>#include &lt;unistd.h&gt;
  #include &lt;errno.h&gt;
  #include &lt;arpa/inet.h&gt;
  #include &lt;map&gt;
  #include &lt;sstream&gt;
  #include &lt;boost/archive/text_oarchive.hpp&gt;
  #include &lt;boost/archive/text_iarchive.hpp&gt;
  #include &lt;boost/serialization/access.hpp&gt;
  #include &lt;boost/static_assert.hpp&gt;
  
  using namespace boost;
  using namespace std;
  
  class gps_position
  {
          public:
          int i ;
          int j;
          friend class boost::serialization::access;
          template&lt;class Archive&gt;
          void serialize(Archive &amp;ar, const unsigned int version)
          {
                  ar &amp; i;
                  ar &amp; j;
          }
  
          gps_position(){};
          gps_position(int a, int b):i(a), j(b){};
  };
  
  int main()
  {
          std::stringstream ss;
           boost::archive::text_oarchive ar( ss );
           gps_position obj(10, 20);
           ar &lt;&lt; obj;
          return 0;
  }
  </code></pre>
  
  <p>But I'm getting following compilation errors:</p>
  
  <pre><code>/usr/include/boost/archive/detail/oserializer.hpp: In function 'void boost::archive::save(Archive&amp;, T&amp;) [with Archive = boost::archive::text_oarchive, T = gps_position]':
  /usr/include/boost/archive/basic_text_oarchive.hpp:78:   instantiated from 'void boost::archive::basic_text_oarchive&lt;Archive&gt;::save_override(T&amp;, int) [with T = gps_position, Archive = boost::archive::text_oarchive]'
  /usr/include/boost/archive/detail/interface_oarchive.hpp:78:   instantiated from 'Archive&amp; boost::archive::detail::interface_oarchive&lt;Archive&gt;::operator&lt;&lt;(T&amp;) [with T = gps_position, Archive = boost::archive::text_oarchive]'
  client.cpp:70:   instantiated from here
  /usr/include/boost/archive/detail/oserializer.hpp:567: error: invalid application of 'sizeof' to incomplete type 'boost::STATIC_ASSERTION_FAILURE&lt;false&gt;'
  </code></pre>
  
  <p>following are the boost libraries are installed on my system:</p>
  
  <pre><code>boost-debuginfo-1.33.1-15.1.el5
  boost-debuginfo-1.33.1-15.1.el5
  boost-devel-1.33.1-15.1.el5
  boost-1.33.1-15.1.el5
  boost-1.33.1-15.1.el5
  boost-doc-1.33.1-15.1.el5
  boost-devel-1.33.1-15.1.el5 
  </code></pre>
  
  <p>Any pointer to resolve these compilation errors?</p>