|its complaining that there is no appropriate default constructor available.|Well, that's because str::ofstream doesn't have a default constructor, as Kevin said.
You've defined structure.outFile
as a reference to a std::ofstream
, which means you need to initialise it with an actual std::ofstream
You'll need to write a constructor for the struct, which takes an ofstream
object (or, even better, a reference to an ofstream
object) as an argument. In the initialisation list for that constructor, you can initialise outFile
with that argument.
Remember, in C++, a struct is exactly the same as a class, except that members are public by default. This means that you can write constructors (and other methods) for them exactly as if they were classes.
Alternatively, you could do what Kevin suggested: make structure.outFile
a pointer, and assign a valid value to it after you've instantiated the struct.
Edit: Apologies for the misinformation in the first line of my response.