Why would this error be happening?

I continue to get the error:

Error 9 error C2248: 'std::basic_ios<_Elem,_Traits>::basic_ios' : cannot access private member declared in class 'std::basic_ios<_Elem,_Traits>'

But I don't know what's causing it...my main function looks like this:

1
2
3
4
5
6
7
8
9
10
#include <iostream>
#include <fstream>
#include "RouteMap.h"
using namespace std;
int main(){
	string filename = "BultMap.txt";
	ifstream filez(filename);
	RouteMap theMap(filez);
cout << "The file map looks like this:" << endl 
     << theMap << endl;


Why is that error occurring?
This is because objects of type basic_ios can't be copied. Your object filez is of type ifstream which derives from basic_ios. You're passing filez by value into the constructor of RouteMap. You should make it so filez is passed by reference.
Topic archived. No new replies allowed.