|
Boost Users : |
From: Dieter Buys (dieter.buys_at_[hidden])
Date: 2006-07-17 12:50:07
Thanks Robert,
This is the error I get when I change that line to exactly what you
suggested:
------ Build started: Project: Test, Configuration: Debug Win32 ------
Compiling...
test_serial.cpp
c:\documents and settings\dieter buys\my
documents\libraries\boost_1_33_1\boost\archive\detail\oserializer.hpp(435)
: error C2027: use of undefined type
'boost::serialization::extended_type_info_null<T>'
with
[
T=gps_position
]
c:\documents and settings\dieter buys\my
documents\libraries\boost_1_33_1\boost\archive\detail\oserializer.hpp(467)
: see reference to function template instantiation 'void
boost::archive::detail::save_pointer_type<Archive,TPtr>::save<gps_position>(Archive
&,const T &,const boost::archive::detail::basic_pointer_oserializer *)'
being compiled
with
[
Archive=boost::archive::text_oarchive,
TPtr=const gps_position *,
T=gps_position
]
c:\documents and settings\dieter buys\my
documents\libraries\boost_1_33_1\boost\archive\detail\oserializer.hpp(447)
: while compiling class template member function 'void
boost::archive::detail::save_pointer_type<Archive,TPtr>::invoke(Archive
&,const gps_position)'
with
[
Archive=boost::archive::text_oarchive,
TPtr=const gps_position *
]
c:\documents and settings\dieter buys\my
documents\libraries\boost_1_33_1\boost\archive\detail\oserializer.hpp(536)
: see reference to class template instantiation
'boost::archive::detail::save_pointer_type<Archive,TPtr>' being compiled
with
[
Archive=boost::archive::text_oarchive,
TPtr=const gps_position *
]
c:\documents and settings\dieter buys\my
documents\libraries\boost_1_33_1\boost\archive\basic_text_oarchive.hpp(78)
: see reference to function template instantiation 'void
boost::archive::save<Archive,const T>(Archive &,const T &)' being compiled
with
[
Archive=boost::archive::text_oarchive,
T=const gps_position *const
]
c:\documents and settings\dieter buys\my
documents\libraries\boost_1_33_1\boost\archive\detail\interface_oarchive.hpp(78)
: see reference to function template instantiation 'void
boost::archive::basic_text_oarchive<Archive>::save_override<T>(T &,int)'
being compiled
with
[
Archive=boost::archive::text_oarchive,
T=const gps_position *const
]
c:\documents and settings\dieter buys\my
documents\temp\testserial\test_serial.cpp(43) : see reference to
function template instantiation 'Archive
&boost::archive::detail::interface_oarchive<Archive>::operator <<<const
gps_position*const >(T &)' being compiled
with
[
Archive=boost::archive::text_oarchive,
T=const gps_position *const
]
c:\documents and settings\dieter buys\my
documents\libraries\boost_1_33_1\boost\archive\detail\oserializer.hpp(438)
: error C3203: 'is_polymorphic' : unspecialized class template can't be
used as a template argument for template parameter 'C', expected a real type
c:\documents and settings\dieter buys\my
documents\libraries\boost_1_33_1\boost\mpl\if.hpp(63) : error C2825:
'T1': must be a class or namespace when followed by '::'
c:\documents and settings\dieter buys\my
documents\libraries\boost_1_33_1\boost\mpl\eval_if.hpp(40) : see
reference to class template instantiation 'boost::mpl::if_<T1,T2,T3>'
being compiled
with
[
T1=int,
T2=boost::mpl::identity<boost::archive::detail::save_pointer_type<boost::archive::text_oarchive,const
gps_position *>::polymorphic<gps_position>>,
T3=boost::mpl::identity<boost::archive::detail::save_pointer_type<boost::archive::text_oarchive,const
gps_position *>::non_polymorphic<gps_position>>
]
c:\documents and settings\dieter buys\my
documents\libraries\boost_1_33_1\boost\archive\detail\oserializer.hpp(438)
: see reference to class template instantiation
'boost::mpl::eval_if<C,F1,F2>' being compiled
with
[
C=int,
F1=boost::mpl::identity<boost::archive::detail::save_pointer_type<boost::archive::text_oarchive,const
gps_position *>::polymorphic<gps_position>>,
F2=boost::mpl::identity<boost::archive::detail::save_pointer_type<boost::archive::text_oarchive,const
gps_position *>::non_polymorphic<gps_position>>
]
c:\documents and settings\dieter buys\my
documents\libraries\boost_1_33_1\boost\mpl\if.hpp(63) : error C2039:
'value' : is not a member of '`global namespace''
c:\documents and settings\dieter buys\my
documents\libraries\boost_1_33_1\boost\mpl\if.hpp(63) : error C2226:
syntax error : unexpected type 'T1'
c:\documents and settings\dieter buys\my
documents\libraries\boost_1_33_1\boost\mpl\if.hpp(63) : error C2144:
syntax error : 'T1' should be preceded by '('
c:\documents and settings\dieter buys\my
documents\libraries\boost_1_33_1\boost\mpl\if.hpp(70) : error C2955:
'boost::mpl::if_c' : use of class template requires template argument list
c:\documents and settings\dieter buys\my
documents\libraries\boost_1_33_1\boost\mpl\if.hpp(37) : see declaration
of 'boost::mpl::if_c'
c:\documents and settings\dieter buys\my
documents\libraries\boost_1_33_1\boost\mpl\eval_if.hpp(41) : fatal error
C1903: unable to recover from previous error(s); stopping compilation
Build log was saved at "file://c:\Documents and Settings\Dieter Buys\My
Documents\Temp\TestSerial\Debug\BuildLog.htm"
Test - 8 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Dieter Buys
Robert Ramey wrote:
> The change I've suggested below should do it. This is explained
> in the "rationale" section of the manual.
>
> Robert Ramey
>
> Dieter Buys wrote:
>>> Hi,
>>>
>>> I am experiencing difficulties in getting the Boost serialization
>>> library to work. There seems to be an error related to object
>>> tracking,
>>> as I am getting BOOST_STATIC_ASSERTION_FAILURE<x>. I am trying to
>>> figure it out using the attached test code. The documentation claims
>>> I should
>>> be putting a BOOST_SERIALIZATION_TRACKING() macro in my file
>>> (presumably directly after my class definition). I did a full text
>>> search over the entire source of the library and nowhere did this
>>> preprocessor macro exist. There is a BOOST_CLASS_TRACKING() macro,
>>> which I tried putting in my source with tracking_never. That seems
>>> to have made no appreciable difference.
>>>
>>> I have absolutely no idea what I am supposed to do. :(
>>> Any help would be appreciated.
>>>
>>> Thanks,
>>> ~ Dieter Buys
>>>
>>
>>
>>> #include <fstream>
>>>
>>> #include <boost/shared_ptr.hpp>
>>>
>>> #include <boost/serialization/serialization.hpp>
>>> #include <boost/serialization/tracking.hpp>
>>> #include <boost/archive/text_oarchive.hpp>
>>> #include <boost/archive/text_iarchive.hpp>
>>>
>>> class gps_position
>>> {
>>> private:
>>> friend class boost::serialization::access;
>>>
>>> template<class Archive>
>>> void serialize(Archive & ar, const unsigned int version)
>>> {
>>> ar & degrees;
>>> ar & minutes;
>>> ar & seconds;
>>> }
>>>
>>> int degrees;
>>> int minutes;
>>> float seconds;
>>>
>>> public:
>>> gps_position() {};
>>> gps_position(int d, int m, float s) : degrees(d), minutes(m),
>>> seconds(s) {} };
>>> // BOOST_CLASS_TRACKING(gps_position, track_never)
>>>
>>> int main(void)
>>> {
>>> std::ofstream ofs("serial.txt");
>>>
>>> gps_position *g = new gps_position(35, 59, 24.567f);
>>> // const gps_position g(35, 59, 24.567f);
>
> const gps_position * const g = new gps_position(35, 59, 24.567f);
>
>>> {
>>> boost::archive::text_oarchive oa(ofs);
>>> oa << g;
>>> }
>>> delete g;
>>>
>>> gps_position *newg;
>>> // gps_position newg;
>>> {
>>> std::ifstream ifs("serial.txt", std::ios::binary);
>>> boost::archive::text_iarchive ia(ifs);
>>> ia >> newg;
>>> }
>>> delete newg;
>>>
>>> return 0;
>>> }
>>>
>>>
>>
>>
>>> _______________________________________________
>>> Boost-users mailing list
>>> Boost-users_at_[hidden]
>>> http://lists.boost.org/mailman/listinfo.cgi/boost-users
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net