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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:58:10+00:00 2026-05-20T17:58:10+00:00

I get these errors when trying to do the following. I have a FileMgr

  • 0

I get these errors when trying to do the following.
I have a FileMgr class to handle an input and an output file with two member functions to copy each line of input into a list and to write to the output from each member of a list. note: the following functions work properly when handled directly by my main! so don’t bother trying to make out what I’m doing with the copy functions, I spent a lot of time figuring them out and now they work fine, the problem is not there.

    FileMgr::FileMgr(string inFilename, string outFilename)
{
    input.open(inFilename);
    output.open(outFilename);
}

bool FileMgr::writeFileToList(list<string> &l)
{
    // copy each line of file into new member of list<string>
    if(!input.is_open())
        return false;

    copy(istream_iterator<string>(input), istream_iterator<string>(), back_inserter(l));

    return true;
}

bool FileMgr::writeListToFile(list<string>::iterator begin, list<string>::iterator end)
{
    // copy each member of list<string> in output file, beginning and ending at iterators begin, end
    // note that I have to pass a "false" end iterator, that is, end--, for it to work
    if(!output.is_open())
        return false;

    copy(begin, end, ostream_iterator<string>(output, "\n"));

    return true;
}

and up to here everything is fine. then my other class, which gets the list from FileMgr, and it’s supposed to let the user edit it (im not there yet because of these errors), so heres part of my declaration:

class Dictionary
{
public:
    Dictionary(string inFileName = "dictionary.txt", string outFileName = "output.txt");
    void userEditor();
//private:
    list<string> dictionary;
    FileMgr manager;
    bool findWord(string word);
    bool addWord(string word);
    bool deleteWord(string word);
    void sortAndFix();
    void saveAndExit();

and here’s my definitions so far, which is basically just the constructor:

    Dictionary::Dictionary(string inFileName, string outFileName)
{
    // open files and copy to list; sort and fix list.
    manager = FileMgr(inFileName, outFileName);

    dictionary.push_back(" ");
    if( manager.writeFileToList(dictionary) )
        cout << "File successfully read from " << inFileName << endl;
    else
        cout << "Error in reading " << inFileName << endl;

    sortAndFix();
}

when I compile, I get these errors somewhere unknown in the constructor just shown (because it’s the only code in the file I get these errors from when compiling):

1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(860): error 

C2249: 'std::basic_ios<_Elem,_Traits>::operator =' : no accessible path to private member declared in virtual base 'std::basic_ios<_Elem,_Traits>'
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 10.0\vc\include\ios(177) : see declaration of 'std::basic_ios<_Elem,_Traits>::operator ='
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          This diagnostic occurred in the compiler generated function 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::operator =(const std::basic_istream<_Elem,_Traits> &)'
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\ostream(604): error C2249: 'std::basic_ios<_Elem,_Traits>::operator =' : no accessible path to private member declared in virtual base 'std::basic_ios<_Elem,_Traits>'
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 10.0\vc\include\ios(177) : see declaration of 'std::basic_ios<_Elem,_Traits>::operator ='
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          This diagnostic occurred in the compiler generated function 'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator =(const std::basic_ostream<_Elem,_Traits> &)'
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]

I can’t understand what’s wrong. my FileMgr works fine when tested from my main, so why would the compiler trip like that when working with FileMgr from another class??

  • 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-20T17:58:11+00:00Added an answer on May 20, 2026 at 5:58 pm

    I believe that your problem is in this line:

    manager = FileMgr(inFileName, outFileName);
    

    From your code in FileMgr it seems that FileMgr has a stream input as a data member. When you execute the above line, you’ll invoke the assignment operator for FileMgr, which by default will try to copy all of the data members one at a time. However, the copy functions for streams are not accessible (they’re marked private and not implemented). The errors you’re getting are almost certainly due to the C++ compiler noticing that it needs to copy the streams, but failing to do so because the copy functions are inaccessible.

    To change this, try initializing manager in the constructor’s member initializer list:

    Dictionary::Dictionary(string inFileName, string outFileName) 
        : manager(inFileName, outFileName) {
        /* ... */
    }
    

    This will initialize manager with the given parameters rather than trying to assign manager an object with the right parameters.

    Hope this helps!

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

Sidebar

Related Questions

I am trying to build a VC++ project and I get these LINK errors:
I have the following LINQ query that returns two objects from my database. These
I have the following class defined in my mapping XML file: <class name=com.data.StateRefData table=STATE_REF>
I get the following errors when trying to build a small and simple project
I get the following error when trying to run my application. There are no
I am having trouble validating my xml schema. I get these errors on the
I have tried following some tutorials and I get the concept of how the
I have the following code snippet.. I get the error Expected identifier, string or
I have been trying to get the PCP LibJingle example to work for several
I have been trying for a few days to get Sonata Media Bundle working

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.