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

  • Home
  • SEARCH
  • 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 7875651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:01:13+00:00 2026-06-03T03:01:13+00:00

I know it may be a simple question, but I’ve been working on it

  • 0

I know it may be a simple question, but I’ve been working on it for the last hour and a half and I’m really lost.

Here the compiler error:

synthesized method ‘File& File::operator=(const File&)’ first required here 

I have this bit of code :

void FileManager::InitManager()
{
    int numberOfFile = Settings::GetSettings()->NumberOfFile() + 1;

    for( unsigned int i = 1; i < numberOfFile; i++ )
    {
        std::string path = "data/data" ;
        path += i;
        path += ".ndb";

        File tempFile( path );

        _files.push_back( tempFile ); // line that cause the error

        /*if( PRINT_LOAD )
        {
            std::cout << "Adding file " << path << std::endl;
        }*/
    }
}

_files if defined in this header :

#pragma once

//C++ Header
#include <vector>

//C Header

//local header
#include "file.h"

class FileManager
{
public:
    static FileManager* GetManager();
    ~FileManager();

    void LoadAllTitle();

private:
    FileManager();
    static FileManager* _fileManager;

    std::vector<File> _files;
};

File is an object I created, it is nothing more than a simple interface to deal with file IO. I have already done vector of user-defined object in the past, but it’s the first time I get this error.

Here is the code for the File object:
File.h

#pragma once

//C++ Header
#include <fstream>
#include <vector>
#include <string>

//C Header

//local header

class File
{
public:
    File();
    File( std::string path );
    ~File();

    std::string ReadTitle();

    void ReadContent();
    std::vector<std::string> GetContent();

private:
    std::ifstream _input;
    std::ofstream _output;

    char _IO;
    std::string _path;
    std::vector<std::string> _content;
};

File.cpp

#include "file.h"

File::File()
    : _path( "data/default.ndb" )
{
}

File::File( std::string path )
    : _path( path )
{
}

File::~File()
{
}

void File::ReadContent()
{
}

std::string File::ReadTitle()
{
    _input.open( _path.c_str() );
    std::string title = "";

    while( !_input.eof() )
    {
        std::string buffer;
        getline( _input, buffer );

        if( buffer.substr( 0, 5 ) == "title" )
        {
            title = buffer.substr( 6 ); // 5 + 1 = 6... since we want to skip the '=' in the ndb
        }
    }

    _input.close();
    return( title );
}

std::vector<std::string> File::GetContent()
{
    return( _content );
}

I’m working under linux with gcc.

Any hints or tips as to what the solution could be is appreciated.

Sorry for the long post.

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-06-03T03:01:15+00:00Added an answer on June 3, 2026 at 3:01 am

    In C++03, std::vector<T> requires that T be copy-constructable and copy-assignable. File contains standard stream data members, and standard streams are non-copyable, so consequently File is as well.

    Your code would work fine in C++11 (with move-construction/move-assignment), but you’ll need to avoid holding standard stream objects by value as data members in C++03. I recommend upgrading your compiler to one that supports C++11 move semantics or using one of Boost’s smart pointers.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This may be very simple question,But please help me. i wanted to know what
I know this may be simple question but want to know every ones opinion
This may seem like a very simple question, but I have been struggling with
I know it may be simple or stupid question but i can`t find an
I realize this may be a very simple question but I need to know
This may be a simple question for those know-how guys. But I cannot figure
I know this question seems subjective but it's really pretty simple. As a long
Does anyone know where I may find a really simple easy jQuery and PHP
I know this may be a dumb question, but my background is more in
I am a relatively new programmer so this may be a really simple question

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.