Boost logo

Boost Users :

From: Diego Molla (diego_at_[hidden])
Date: 2006-06-22 05:28:12


Thanks for your advice, Gennaro.

I had to move the following includes to the beginning of the file:

#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>

I also realised that the following gives the same error of incomplete type:

void
SetOfRules::save(const string &fileName)
// Save into a file
{
    ofstream fout(fileName.c_str());
    boost::archive::text_oarchive oa(fout);
    oa << *this;
    fout.close();
}

I had to use a helper function like this:

void
_save(const SetOfRules &sor, const string &fileName);

void
SetOfRules::save(const string &fileName)
// Save into a file
{
   _save(*this,fileName);
}

void _save(const SetOfRules &sor, const string &fileName)
{
   std::ofstream fout(fileName.c_str());
   boost::archive::text_oarchive oa(fout);
   oa << sor;
   fout.close();
} // save

And similarly to load a class.

Diego

>>Hello,
>>
>>I have an error that is puzzling me. I have defined serialization of
>>several custom classes, and everything worked perfectly until we've
>>changed to a new Linux OS and had to reinstall Boost. Now the program
>>doesn't compile and the error given is:
>>
>> error: incomplete type
>>'boost::serialization::extended_type_info_null<SetOfRules>' used in
>>nested name specifier
>>
>>I don't really understand why it says there is an incomplete type when
>>there used to be no errors. The same error happens with all the classes
>>where I've defined serialization.
>
> I'm not too much into the latest gcc developments (certainly others
> will give a more accurate reply) but it looks like a two-phase lookup
> issue: at the time your function is parsed SetOfRules is actually
> incomplete, but the old gcc version you had didn't diagnose it and
> delayed analisys to instantiation time.
>
> This is just my feeling. You might try moving SetOfRules' #include
> before.
>
> --Gennaro.

-- 
Do you want to know what is going on in Language Technology in
Australia and New Zealand? Join ALTA -- http://www.alta.asn.au/
     This message is intended for the addressee named and may
     contain confidential information.  If you are not the intended
     recipient, please delete it and notify the sender.  Views expressed
     in this message are those of the individual sender, and are not
     necessarily the views of Macquarie University.
---------------------------------------------------------------------
Diego MOLLA ALIOD                                 diego_at_[hidden]
Department of Computing               http://www.ics.mq.edu.au/~diego
Macquarie University

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