We help IT Professionals succeed at work.
Get Started

error C2248 basic_ios when upgrading C++ code

riceman0
riceman0 asked
on
508 Views
Last Modified: 2013-11-20
Hi, I'm upgrading some fairly old MFC code (Visual C++ 4.0) to Visual C++ 2008, and I think I've switched the includes over to the standard libraries (well, by changing #include "fstream.h" to #include "fstream") and some of the old code gives me this error:

error C2248: 'std::basic_ios<_Elem,_Traits>::basic_ios' : cannot access private member declared in class 'std::basic_ios<_Elem,_Traits>'      c:\program files\microsoft visual studio 9.0\vc\include\fstream

The offending code (found by process of elimination, since the error points to inside fstream; the error seems to be in WrtDisclaimer) is below, and it seemed to compile before, does anyone have ideas as to what has changed to cause this problem?

Thanks very much in advance...

void WrtDisclaimer(ofstream OutFile)
{
  CenterLine(OutFile, "*  *  *  *  *  *  *  *  *  *  *  *  *  *  *");
  OutFile << "\n";
  int i=0;
  while (Disclaimer[i] != NULL)
  {
	  CenterLine(OutFile, Disclaimer[i]);
	  i++;
  }
  OutFile << "\n";
}
 
void CenterLine(ofstream OutFile, char *str)
{
  int nsp, i;
 
  nsp = (int) ((80 - strlen(str))/2);
  for ( i=0; i<nsp; ++i)
		OutFile << " ";
  OutFile << str;
  OutFile << "\n";
}

Open in new window

Comment
Watch Question
CERTIFIED EXPERT
Top Expert 2009
Commented:
This problem has been solved!
Unlock 1 Answer and 1 Comment.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE