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 7523583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T02:50:43+00:00 2026-05-30T02:50:43+00:00

I am working on Agent modeling project and decided to use repast for that.

  • 0

I am working on Agent modeling project and decided to use repast for that.
I have pre-installed bunch of libraries before and downloaded Repast source and trying include it in project. But suddenly getting error which I can not understand.

error: no match for ‘operator+’ in ‘std::operator+(const std::basic_string<_CharT, _Traits, _Alloc>&, const _CharT*) [with _CharT = char, _Traits = std::char_traits, _Alloc = std::allocator](((const char*)”_”)) + boost::filesystem3::path::filename() const()’

CODE:

NCDataSet::NCDataSet(std::string file, const Schedule& schedule) :
file_(file), schedule_(&schedule), start(0), open(true) 
{
    rank = RepastProcess::instance()->rank();
    if (rank == 0) {
        fs::path filepath(file);
        if (!fs::exists(filepath.parent_path())) {
            fs::create_directories(filepath.parent_path());
        } else if (fs::exists(filepath)) {
            string ts;
            repast::timestamp2(ts);
            fs::path to(filepath.parent_path() / (ts + "_" + filepath.filename()));
        fs::rename(filepath, to);
    }
}
}
ERROR LINE: fs::path to(filepath.parent_path() / (ts + "_" + filepath.filename()));

Thanks!!!

  • 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-30T02:50:45+00:00Added an answer on May 30, 2026 at 2:50 am

    The error indicates that it can’t match the operator+, ie you’re trying append two invalid types.

    It looks like path::filename doesn’t return a std::string.

    class path {
      // ...
      path  filename() const;
      // ...
    };
    

    It’s reasonable to think about infix operators as keeping the type of the left hand side of the operation. In this case, std::string doesn’t know anything about boost or filesystem::path.

    So you likely need to change the offending line to something like this:

    fs::path to(filepath.parent_path() / (ts + "_" + filepath.filename().string() ));
    

    I find when it isn’t immediately obvious how a bunch of inline operations are causing an error, it’s a good practice to separate everything on to it’s own line. In this case, it would even make the code a bit clearer as to your intention.

    std::string old_filename(filepath.filename().string());
    std::string new_filename = ts +"_"+ old_filename;
    fs::path to( filepath.parent_path() / new_filename);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Working on a project at the moment and we have to implement soft deletion
Working on a project that parses a log of events, and then updates a
I'm have the following working example to retrieve a specific Wikipedia page that returns
I'm working on a word press project. I noticed that rss is not working
I have been working on an iPhone app that has a feature of uploading
I am working on a small reporting application. I have two tables Agent Table
So I'm working on a project for a realtor. I have the following objects/MySQL
I am working on a ASP .NET mVC project & i have to change
I'm working on a project that uses a Windows Mobile device to call a
I have a working Lotus Notes agent. Running on LN 7. My agent runs

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.