I am working on ubuntu 12.04LTS and am using clang 3.4.
I have a CMake project and want to use boost serialization library. I downloaded boost 1.55.0 from SourceForge.
The project folder tree is as follows:
MyProject
| Source
| | main.cpp
| | CMakeLists.txt
| Build
| Libraries
| | Boost1p55p0
| | | boost
| | | ...other boost data
| | | build
| | | | include
| | | | lib
So, in the directory, Boost1p55p0I created a new directory build, so bootstrap looked like this:
./bootstrap.sh --prefix=build/
Then i did
./b2
and
./b2 install
So a minimal non-working example:
CMakeLists.txt:
cmake_minimum_required (VERSION 2.6)
set( CMAKE_C_COMPILER clang )
set( CMAKE_CXX_COMPILER clang++ )
set( CMAKE_LINKER llvm-link )
project (Test)
include_directories( ${PROJECT_SOURCE_DIR} ../Libraries/Boost1p55p0/build/include )
set( sources ${sources} main )
add_executable(Test ${sources})
set( OperatingSystem "Linux" )
set( CMAKE_CXX_FLAGS "-std=c++11" )
find_library( PATH_TO_BoostSerialization boost_serialization ../Libraries/Boost1p55p0/build/lib/ )
target_link_libraries (Test ${PATH_TO_BoostSerialization})
main.cpp (from the tutorial , but with xml archives):
#include <fstream>
#include <string>
#include <boost/archive/xml_oarchive.hpp>
#include <boost/archive/xml_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){}
};
int main() {
std::string inFileName = "testIn.xml";
std::string outFileName = "testOut.xml";
std::ofstream ofs(outFileName);
const gps_position g(35, 59, 24.567f);
{
boost::archive::xml_oarchive oa(ofs);
oa << g;
}
return 0;
}
And now I get the following compiler error:
[cut off directory tree here]Boost1p55p0/build/include/boost/archive/basic_xml_oarchive.hpp:92:9: error: no matching function for call to
'assertion_failed'
BOOST_MPL_ASSERT((serialization::is_wrapper< T >));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[cut off directory tree here]Boost1p55p0/build/include/boost/mpl/assert.hpp:287:11: note: expanded from macro 'BOOST_MPL_ASSERT'
boost::mpl::assertion_failed<false>( \
I do not know where the error is. I don’t know if I know.
Thank you very much in advance