C++: incomplete type and cannot be defined

A very confusing error just now: error: aggregate ‘std::ofstream out’ has incomplete type and cannot be defined from simple code: std::ofstream out; And the similar one: error: variable ‘std::ofstream out’ has initialiser but incomplete type from this code: std::ofstream out(fname.c_str(),std::ios_base::app); Using this didn’t help: #include <iostream> Using this also didn’t help: #include <ofstream> That was…

Read more...