Boost logo

Boost Users :

From: Richard Jennings (Richard.Jennings_at_[hidden])
Date: 2005-08-08 06:23:18

I'm finding an apparent dependency between some non-serialization
headers and the use of BOOST_CLASS_EXPORT.

If boost/optional.hpp or boost/format.hpp or boost/bind.hpp are included
before BOOST_CLASS_EXPORT is used then I get the compilation error:

[C++ Error] export.hpp(210): E2102 Cannot use template 'boost::type<T>'
without specifying specialization parameters
[C++ Error] export.hpp(210): E2293 ) expected

If they are included after then everything's ok. This is BCB 5.6.4.

This precludes me having optional/bind/format in a precompiled header
and also means it's a bit tricky ensuring the correct inclusion order
for a large project.


Here's the code to demonstrate it:
#pragma hdrstop
#include <boost/archive/xml_oarchive.hpp>
#include <boost/archive/xml_iarchive.hpp>
#include <boost/serialization/serialization.hpp>
#include <boost/serialization/export.hpp>

#pragma link "libboost_serialization-bcb-mt-d-1_33.lib"

// !! These can't be included here
//#include <boost/format.hpp>
//#include <boost/bind.hpp>
//#include <boost/optional.hpp>
class A
  template <class ArchiveT>
  serialize(ArchiveT & ar, unsigned int)

// Including here is ok
#include <boost/format.hpp>
#include <boost/bind.hpp>
#include <boost/optional.hpp>

#pragma argsused
int main(int argc, char* argv[])
  boost::optional<int> SomeValue;
  A InstanceOfA;
  return 0;

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at