Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1032129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T14:02:08+00:00 2026-05-16T14:02:08+00:00

I am using boost serialization on windows, and I wanted to test my code

  • 0

I am using boost serialization on windows, and I wanted to test my code on linux (ubuntu) and unfortunately it does not compile.

#include <string>
#include <fstream>

#include <boost/archive/xml_iarchive.hpp>
#include <boost/archive/xml_oarchive.hpp>


#include <boost/serialization/string.hpp>
#include <boost/serialization/nvp.hpp>
#include <boost/serialization/export.hpp>


class MyClass
{
  public:
    int something;
    MyClass();

    template<class archive> void serialize(archive& ar, const unsigned int version)
    {
      using boost::serialization::make_nvp;
      ar & make_nvp("something", something);
    }


};



MyClass::MyClass()
  : something(0)
{
}

int main(int argc, char ** argv)
{
  std::cout << "Hello";
  MyClass obj();

  std::string path = "here.xml";

  std::ifstream ifs(path.c_str());
  if (ifs.good())
  {
    boost::archive::xml_iarchive ia(ifs);
    ia >> boost::serialization::make_nvp("obj", obj);

    ifs.close();
    return true;
  }
  else
    return false;

}

Here is my compile line:

g++ test.cpp -lboost-serialization

And here is what I get:

In file included from /usr/include/boost/archive/detail/interface_iarchive.hpp:23,
                 from /usr/include/boost/archive/detail/common_iarchive.hpp:21,
                 from /usr/include/boost/archive/basic_xml_iarchive.hpp:23,
                 from /usr/include/boost/archive/xml_iarchive.hpp:24,
                 from test.cpp:6:
/usr/include/boost/archive/detail/iserializer.hpp: In function ‘void boost::archive::load(Archive&, const T&) [with Archive = boost::archive::xml_iarchive, T = MyClass()]’:
/usr/include/boost/archive/detail/common_iarchive.hpp:61:   instantiated from ‘void boost::archive::detail::common_iarchive<Archive>::load_override(T&, int) [with T = MyClass(), Archive = boost::archive::xml_iarchive]’
/usr/include/boost/archive/basic_xml_iarchive.hpp:81:   instantiated from ‘void boost::archive::basic_xml_iarchive<Archive>::load_override(const boost::serialization::nvp<T>&, int) [with T = MyClass(), Archive = boost::archive::xml_iarchive]’
/usr/include/boost/archive/xml_iarchive.hpp:75:   instantiated from ‘void boost::archive::xml_iarchive_impl<Archive>::load_override(T&, int) [with T = const boost::serialization::nvp<MyClass()>, Archive = boost::archive::xml_iarchive]’
/usr/include/boost/archive/detail/interface_iarchive.hpp:61:   instantiated from ‘Archive& boost::archive::detail::interface_iarchive<Archive>::operator>>(T&) [with T = const boost::serialization::nvp<MyClass()>, Archive = boost::archive::xml_iarchive]’
test.cpp:48:   instantiated from here
/usr/include/boost/archive/detail/iserializer.hpp:570: error: no matching function for call to ‘load_wrapper(boost::archive::xml_iarchive&, MyClass (&)(), boost::serialization::is_wrapper<MyClass()>)’

I am probably missing an include…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T14:02:08+00:00Added an answer on May 16, 2026 at 2:02 pm

    You’ve encountered the Most Vexing Parse. In your main method, change

    MyClass obj();
    

    to

    MyClass obj;
    

    also, on my Linux system, the link line is

    g++ test.cpp -lboost_serialization
    

    Note the underscore instead of dash, like in your example

    g++ test.cpp -lboost-serialization
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 517k
  • Answers 517k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You should expose a ContentProvider. "Content providers store and retrieve… May 16, 2026 at 7:45 pm
  • Editorial Team
    Editorial Team added an answer You could represent the 6 bool options as an enum… May 16, 2026 at 7:45 pm
  • Editorial Team
    Editorial Team added an answer Doing exactly what you want (prevent users from 'unauthorized' apps… May 16, 2026 at 7:45 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I am using boost serialization with xml files with a C++ program. When I
I have a problem using boost serialization using binary archives. It works when using
I am developing unit test cases for an application using Boost.test libraries. There are
I am working on a client-server application that uses boost::serialization library for it's serialization
I'm starting to use boost::serialization on XML archives. I can produce and read data,
I know that you can use boost serialization to serialize to a text format
I'm deserializing a fair amount of data through Boost.Serialization (one for each frame). However,
I'm using boost::iostreams::gzip_decompressor with boost::iostreams::filterimg_streambuf to read gzip files. some of my files have
I'm using Boost.Range to pass around some data and a container class for this
I'm using boost::ptree for parsing fils. The problem is that I can't create the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.