C++ standard classes inside my classes

Dear ROOTers,

I have used c++ classes (such as string, or ifstream to read a text file) without problems both in interactive ROOT sessions and in unnamed macros.

Now I’m using them inside the constructor of a class (the skeleton code of this class was generated by TTree::MakeClass) and I have a problem.

The declaration (automatic variable declared inside constructor for reading a text file. This file is closed before constructor ends):

gives me the following error:
aggregate `std::ifstream mapfile’ has incomplete type and cannot be defined

I added:

#include <string>
#include <iostream>
using namespace std;

at the beginning of .C file, before including .h, but this is not the solution.

Where is the error?

Thank you

Hi Matteo,

a hint: check which header defines ifstream.

Cheers, Axel.

Ops… sorry… I forgot that ifstream is in