[serialization] problem with Borland C++ Builder 6

Hi, I've just started using the serialization library, and am trying to do so with BC++6. If I'm right, it should work just as long as I remove support for xml archives (because Spirit doesn't work on BC++) I've a class Cliente which has an appropriate serialize member fxn. And a manager class called Clientes which stores a std::vector<boost::shared_ptr<Cliente> > When doing: void Clientes::serialize(Archive& ar, unsigned const version) { ar & m_imp->m_clientes; // where m_imp is a pimpl-style struct // m_clientes is of the type specified above } (this is trimmed down code, I can post the original if required) I get the following error: [C++ Error] serialization.hpp(121): E2015 Ambiguity between 'boost::serialization::void serialize< boost::archive::text_iarchive , boost::shared_ptr<cc::servidor::Cliente> > ( boost::archive::text_iarchive & , _STL::vector<boost::shared_ptr<cc::servidor::Cliente> > & , const unsigned int )' and 'boost::serialization::void serialize< boost::archive::text_iarchive , _STL::vector<boost::shared_ptr<cc::servidor::Cliente> > >( boost::archive::text_iarchive & , _STL::vector<boost::shared_ptr<cc::servidor::Cliente> > & , const unsigned int )' (I removed the allocator parts to make the message clearer) So the question is, how do I remove the ambiguity? Thanks for your help... Pablo Aguilar

Pablo Aguilar wrote:
Hi,
I've just started using the serialization library, and am trying to do so with BC++6.
If I'm right, it should work just as long as I remove support for xml archives (because Spirit doesn't work on BC++)
I've a class Cliente which has an appropriate serialize member fxn. And a manager class called Clientes which stores a
std::vector<boost::shared_ptr<Cliente> >
When doing: void Clientes::serialize(Archive& ar, unsigned const version) { ar & m_imp->m_clientes;
// where m_imp is a pimpl-style struct // m_clientes is of the type specified above }
(this is trimmed down code, I can post the original if required)
I get the following error: [C++ Error] serialization.hpp(121): E2015 Ambiguity between 'boost::serialization::void serialize< boost::archive::text_iarchive , boost::shared_ptr<cc::servidor::Cliente> > ( boost::archive::text_iarchive & , _STL::vector<boost::shared_ptr<cc::servidor::Cliente> > & , const unsigned int )'
and
'boost::serialization::void serialize< boost::archive::text_iarchive , _STL::vector<boost::shared_ptr<cc::servidor::Cliente> > >( boost::archive::text_iarchive & , _STL::vector<boost::shared_ptr<cc::servidor::Cliente> > & , const unsigned int )'
(I removed the allocator parts to make the message clearer)
So the question is, how do I remove the ambiguity?
Thanks for your help...
Pablo Aguilar

Pablo Aguilar wrote:
Hi,
I've just started using the serialization library, and am trying to do so with BC++6.
If I'm right, it should work just as long as I remove support for xml archives (because Spirit doesn't work on BC++)
A better alternative is to install spirit 1.6x on your machine. That way you get xml archives and you have everything the same as other boost users.
I've a class Cliente which has an appropriate serialize member fxn. And a manager class called Clientes which stores a
std::vector<boost::shared_ptr<Cliente> >
When doing:
I presume you included the template statement template<class Archive>
void Clientes::serialize(Archive& ar, unsigned const version) { ar & m_imp->m_clientes;
// where m_imp is a pimpl-style struct // m_clientes is of the type specified above }
(this is trimmed down code, I can post the original if required)
I get the following error: [C++ Error] serialization.hpp(121): E2015 Ambiguity between 'boost::serialization::void serialize< boost::archive::text_iarchive , boost::shared_ptr<cc::servidor::Cliente> > ( boost::archive::text_iarchive & , _STL::vector<boost::shared_ptr<cc::servidor::Cliente> > & , const unsigned int )'
and
'boost::serialization::void serialize< boost::archive::text_iarchive , _STL::vector<boost::shared_ptr<cc::servidor::Cliente> > >( boost::archive::text_iarchive & , _STL::vector<boost::shared_ptr<cc::servidor::Cliente> > & , const unsigned int )'
(I removed the allocator parts to make the message clearer)
So the question is, how do I remove the ambiguity?
are you including the header boost/serialization/shared_ptr.hpp instead of boost/shared_ptr.hpp ?
Thanks for your help...
Pablo Aguilar
Truth is - i havn't seen this before - its hard to make a judgement without seeing the whole program. Ass

Comments below Robert Ramey wrote:
Pablo Aguilar wrote:
Hi,
I've just started using the serialization library, and am trying to do so with BC++6.
If I'm right, it should work just as long as I remove support for xml archives (because Spirit doesn't work on BC++)
A better alternative is to install spirit 1.6x on your machine. That way you get xml archives and you have everything the same as other boost users.
Ok, thanks, but since I'm not using it for the time being, I might as well leave it out. Besides, I'm more focused right now on getting it to work in the first place.
I've a class Cliente which has an appropriate serialize member fxn. And a manager class called Clientes which stores a
std::vector<boost::shared_ptr<Cliente> >
When doing:
I presume you included the template statement
template<class Archive>
I did.
void Clientes::serialize(Archive& ar, unsigned const version) { ar & m_imp->m_clientes;
// where m_imp is a pimpl-style struct // m_clientes is of the type specified above }
(this is trimmed down code, I can post the original if required)
I get the following error: [C++ Error] serialization.hpp(121): E2015 Ambiguity between 'boost::serialization::void serialize< boost::archive::text_iarchive , boost::shared_ptr<cc::servidor::Cliente> > ( boost::archive::text_iarchive & , _STL::vector<boost::shared_ptr<cc::servidor::Cliente> > & , const unsigned int )'
and
'boost::serialization::void serialize< boost::archive::text_iarchive , _STL::vector<boost::shared_ptr<cc::servidor::Cliente> > >( boost::archive::text_iarchive & , _STL::vector<boost::shared_ptr<cc::servidor::Cliente> > & , const unsigned int )'
(I removed the allocator parts to make the message clearer)
So the question is, how do I remove the ambiguity?
are you including the header boost/serialization/shared_ptr.hpp instead of boost/shared_ptr.hpp ?
I was including boost/shared_ptr.hpp Changed that now, and I'm still getting the same error. I'll take another shot at this tomorrow (I'm not thinking clearly anymore, it's 2:00am!)
Thanks for your help...
Pablo Aguilar
Truth is - i havn't seen this before - its hard to make a judgement without seeing the whole program.
Ass
?? I suppose you were going to write something more, right? Or is that what I get for not reading the docs properly ;-) ? Pablo

After reviewing and responding to your private message, I've concluded that one problem is that that tthe messages from borland compiler are not has helpful as they could be. In this case they are pretty confusing. Given that you have to use Borland, and that the serialization library works quite well with borland (Thanks in large part to Pavel V.), I would suggest you get another compiler just to help with cases like this. I often use a different compiler just to get a different error message. I can recommend gcc as well as Comeau for this purpose. Its a pain in the neck to install another compiler, but it is very helpful when one is trying to track down a cryptic syntax error. Robert Ramey

Robert Ramey wrote:
After reviewing and responding to your private message, I've concluded that one problem is that that tthe messages from borland compiler are not has helpful as they could be. In this case they are pretty confusing. Given that you have to use Borland, and that the serialization library works quite well with borland (Thanks in large part to Pavel V.), I would suggest you get another compiler just to help with cases like this. I often use a different compiler just to get a different error message. I can recommend gcc as well as Comeau for this purpose. Its a pain in the neck to install another compiler, but it is very helpful when one is trying to track down a cryptic syntax error.
Robert Ramey
You're right the error messages are terrible. And to top it off, some error messages I get, lead me to just about anywhere in any file rather than to the source of the problem when double clicking on 'em. The lack of a template instantiation stack makes troubleshooting even harder... I don't really have to use Borland, I could use VC7.1, but as it is, I'm already having to learn ACE, Boost.Serialization, Boost.Date_Time, I would've used Boost.MultiIndex but it wasn't available on BC++ so I didn't want to throw in a GUI library also (no, I didn't want to use MFC.. GUI-wise, VCL is far superior) I'll take a shot at testing with gcc, thanks for the suggestion and your help with this... Pablo Aguilar

If you have VC 7.1 you can use that for double checking syntax. In my view the error messages are quite good. (Of course, nothing's perfect). With a little bit of effort you can keep your GUI stuff in separate modules from the boost stuff and this will make things much easier as well. Robert Ramey Pablo Aguilar wrote:
I don't really have to use Borland, I could use VC7.1, but as it is, I'm already having to learn ACE, Boost.Serialization, Boost.Date_Time, I would've used Boost.MultiIndex but it wasn't available on BC++ so I didn't want to throw in a GUI library also (no, I didn't want to use MFC.. GUI-wise, VCL is far superior)
I'll take a shot at testing with gcc, thanks for the suggestion and your help with this...

Normally I wouldn't have complained about the error messages, but trying to figure this problem out has been somewhat frustrating and the error messages I'm given really don't help at all. Using "normal" Borland C++ (VCL style I mean) I hand't had trouble before. BTW, that GUI-engine separation is precisely what I'm aiming for. It hadn't ocurred to me though, to use a separate compiler to aid with error messages. Pablo Aguilar Robert Ramey wrote:
If you have VC 7.1 you can use that for double checking syntax. In my view the error messages are quite good. (Of course, nothing's perfect). With a little bit of effort you can keep your GUI stuff in separate modules from the boost stuff and this will make things much easier as well.
Robert Ramey
Pablo Aguilar wrote:
I don't really have to use Borland, I could use VC7.1, but as it is, I'm already having to learn ACE, Boost.Serialization, Boost.Date_Time, I would've used Boost.MultiIndex but it wasn't available on BC++ so I didn't want to throw in a GUI library also (no, I didn't want to use MFC.. GUI-wise, VCL is far superior)
I'll take a shot at testing with gcc, thanks for the suggestion and your help with this...

"Pablo Aguilar" wrote:
I get the following error: [C++ Error] serialization.hpp(121): E2015 Ambiguity between 'boost::serialization::void serialize< boost::archive::text_iarchive , boost::shared_ptr<cc::servidor::Cliente> > ( boost::archive::text_iarchive & , _STL::vector<boost::shared_ptr<cc::servidor::Cliente> > & , const unsigned int )'
and
'boost::serialization::void serialize< boost::archive::text_iarchive , _STL::vector<boost::shared_ptr<cc::servidor::Cliente> > >( boost::archive::text_iarchive & , _STL::vector<boost::shared_ptr<cc::servidor::Cliente> > & , const unsigned int )'
Could you post complete program? (From my experience Serialization usually works with BCB so your problem may have solution.) /Pavel

Thanks Pavel V. and Robert R. for your helpful suggestions. I've made the changes to the code you both told me about. Finally used vc71 to test compiler errors. I also implemented dummy serialization functions for date_time components for now, just to get the whole thing to compile. So, I can compile with vc71, but couldn't do so with BCB. So, just out of curiosity, I tried compiling with BCB's command line compiler and got some more errors, which I then fixed; and now I CAN compile with BCB's CLC but still can't from within the Builder IDE. I can only conclude that it's a project specific option that's causing me trouble. BTW, the docs (both the 1.32.0 distribution and online) have a typo in the "state_saver" section: <quote> History This is a generalization if Daryle Walker's io_state_saver library. </quote> I believe it should say "of" instead of "if". Pablo Aguilar

Done! It turns out I'm having problems with the precompiled headers. Once I changed #pragme hdrstop to skip serialization, I no longer got the ambiguity error which I kept getting here. So it's just a matter of figuring out why being in the precompiled header matters. Thanks again for your help. Pablo Aguilar

"Pablo Aguilar" wrote:
...and now I CAN compile with BCB's CLC but still can't from within the Builder IDE....
One little factoid: CPP preprocessor implemented in standalone Borland precompiler is different from the one integrated inside BCB IDE. One must just love this tool. /Pavel
participants (3)
-
Pablo Aguilar
-
Pavel Vozenilek
-
Robert Ramey