id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 6107,Boost sample source code cant compile .boost1.33.1 and gcc4.1.2,anonymous,Robert Ramey,"Question about the boost sample program I'm trying to compile the following code example: #include #include #include class gps_position { private: friend class boost::serialization::access; template void serialize(Archive & ar, const unsigned int version) { ar & degrees; ar & minutes; ar & seconds; } int degrees; int minutes; float seconds; public: gps_position() { degrees = 0; minutes = 0; seconds = 0.0; }; gps_position(int d, int m, float s) : degrees(d), minutes(m), seconds(s) {} }; class bus_stop { friend class boost::serialization::access; template void serialize(Archive & ar, const unsigned int version) { ar & latitude; ar & longitude; } gps_position latitude; gps_position longitude; public: bus_stop(){ } bus_stop(const gps_position & lat_, const gps_position & long_) : latitude(lat_), longitude(long_) { } virtual ~bus_stop(){ } }; int main() { // create and open a character archive for output std::ofstream ofs(""busfile""); // create class instance of gps_position const gps_position latitude(1, 2, 3.3f); const gps_position longitude(4, 5, 6.6f); bus_stop stop(latitude, longitude); // save data to archive { boost::archive::text_oarchive oa(ofs); // write class instance to archive oa << stop; } // ... sometime later restore class instance of bus_stop to its orginal state bus_stop newstop; { // create and open an archive for input std::ifstream ifs(""busfile"", std::ios::binary); boost::archive::text_iarchive ia(ifs); // read class state of bus_stop form archive ia >> newstop; } return 0; } With the following command line: g++ -o boostSample demo.cc -lboost_serialization and it throws an compile error: /usr/include/boost/archive/detail/oserializer.hpp: In function ‘void boost::archive::save(Archive&, T&) [with Archive = boost::archive::text_oarchive, T = bus_stop]’: /usr/include/boost/archive/basic_text_oarchive.hpp:78: instantiated from ‘void boost::archive::basic_text_oarchive::save_override(T&, int) [with T = bus_stop, Archive = boost::archive::text_oarchive]’ /usr/include/boost/archive/detail/interface_oarchive.hpp:78: instantiated from ‘Archive& boost::archive::detail::interface_oarchive::operator<<(T&) [with T = bus_stop, Archive = boost::archive::text_oarchive]’ demo.cc:67: instantiated from here /usr/include/boost/archive/detail/oserializer.hpp:567: error: invalid application of ‘sizeof’ to incomplete type ‘boost::STATIC_ASSERTION_FAILURE And the boost version is 1.33.1. By the way, the OS version is redhat 5.6 . Linux rhel5 2.6.18-238.el5 #1 SMP Sun Dec 19 14:24:47 EST 2010 i686 i686 i386 GNU/Linux The gcc version is 4.1.2 . g++ -v Using built-in specs. Target: i386-redhat-linux config option: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --disable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=i386-redhat-linux thread module: posix gcc version 4.1.2 20080704 (Red Hat 4.1.2-50) But the same codes can be compiled well, no compile errors in the other linux. Such as redhat4.3 and 6.0 How can I fix it? Thank you.",Bugs,closed,To Be Determined,serialization,,Problem,wontfix,,