C++: incomplete type and cannot be defined

A very confusing error just now: error: aggregate ‘std::ofstream out’ has incomplete type and cannot be definedfrom simple code: std::ofstream out;And the similar one: error: variable ‘std::ofstream out’ has initialiser but incomplete typefrom 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 confusing me most, but now I…

Read more...