When I try to compile my program the compiler complains about this line in a .h file that I #included.
ostream & Print (ostream & stream);
How can this be fixed?
When I try to compile my program the compiler complains about this line in a .h file that I #included.
ostream & Print (ostream & stream);
How can this be fixed?
If you #include <ostream>
, ostream
will be defined in the std
namespace:
#include <ostream>
// ...
std::ostream & Print (std::ostream & stream);
Minimal code for this declaration to compile:
#include <iosfwd>
using namespace std;
Use 'using' if you don't want to pull the whole std namespace, eg :
#include <iosfwd>
using std::ostream;