Hey,
How do you declare a variable as ofstream type in Visual Studio 2010.
I have the following and am getting an error stating:syntax error:missing; before identifer m_Log.
ofstream m_Log;
When I write this same code in Visual Studio C++ 6.0, I don't get an error.
Any help will be appreciated!!
Thanks in Advance!!
Visual Studio 6.0 comes from a time when C++ looked a lot like C.
Nowadays the header files with an .h extension are deprecated and only there for compatibility. Also heavy use is made of namespaces (see this http://www.cplusplus.com/doc/tutorial/namespaces/ ).
Anyway, you need to
1 2 3
#include <fstream> // notice lack of ".h"
std::ofstream m_Log; // if you use one of hamsterman's "using" directives you can omit the "std::"