   fstream error
  the line that is causing the error is:fstream mem("leaks.txt");and the error is:c:\documents and settings\jason\my documents\visual studio 2005\projects\leaky\leaky\leaky.cpp(57) : error C2440: 'initializing' : cannot convert from 'const char [10]' to 'int'   There is no context in which this conversion is possiblewhat the hell is that about why do i need to pass an int?could someone please explain?btw i'm using std::fstream   
  Make sure you #include <fstream>.For future reference, please post all of the errors your compiler spews out, as well as more of your code.[edit] I say this because the previous error was probably c:\documents and settings\jason\my documents\visual studio 2005\projects\leaky\leaky\leaky.cpp(57) : error C2079: 'mem' uses undefined class 'std::basic_fstream<_Elem,_Traits>', which would have given you the answer.   ;  sorry about the stupid mistake, i forgot to check that. :-S   ;  No need to apologize. We've all been there.   ;  this not related to the previous error but its in the same project so i didn't want to start a new tread.this is my time using exceptions, so maybe i'm missing something stupid.anyway here is the whole func that is generating the error:inline void * __cdecl operator new(size_t size, const char *file, int line){try{// Allocate the memory check that the allocation was a success and add to the trackerif(size == 0){size = 1;// Make sure a size of 0 is not sent to malloc}void *ptr = (void *)malloc(size);if(ptr == 0){throw bad_alloc;}mem_info *m_info = new mem_info(ptr, size, file, line);AddTracker(m_info);return(ptr);}catch(bad_alloc){// Handle an errorfstream mem("leaks.txt");mem << "MEMORY ALLOCATION ERROR" << "\n";}};i only have 1 error:leaky.cppc:\documents and settings\jason\my documents\visual studio 2005\projects\leaky\leaky\leaky.cpp(17) : error C2275: 'std::bad_alloc' : illegal use of this type as an expression   c:\program files\microsoft visual studio 8\vc\include\exception(334) : see declaration of 'std::bad_alloc'Build Time 0:00Build log was saved at "file://c:\Documents and Settings\Jason\My Documents\Visual Studio 2005\Projects\leaky\leaky\Debug\BuildLog.htm"leaky - 1 error(s), 0 warning(s)   ;  The line throw badalloc; is not correct; strictly, by the syntax, this would throw the entire class std::badalloc which doesn't make sense. Instead, you want to throw a temporary instance of std::badalloc, which means you need to invoke a constructor. You can create an anonymous instance easily by tweaking the line to throw badalloc(); which has the effect of calling the default constructor for std::badalloc, generating a temporary unnamed instance, and throwing that as the exception.   ;  i changed the line to:inline void * __cdecl operator new(size_t size, const char *file, int line){try{// Allocate the memory check that the allocation was a success and add to the trackerif(size == 0){size = 1;// Make sure a size of 0 is not sent to malloc}void *ptr = (void *)malloc(size);if(ptr == 0){throw bad_alloc();}mem_info *m_info = new mem_info(ptr, size, file, line);AddTracker(m_info);return(ptr);}catch(bad_alloc){// Handle an errorfstream mem("leaks.txt");mem << "MEMORY ALLOCATION ERROR" << "\n";}};but i get these error now:leaky.cppc:\program files\microsoft visual studio 8\vc\include\list(901) : error C2784: 'bool std::operator ==(const std::list<_Ty,_Ax> &,const std::list<_Ty,_Ax> &)' : could not deduce template argument for 'const std::list<_Ty,_Ax> &' from 'mem_info'   c:\program files\microsoft visual studio 8\vc\include\list(1257) : see declaration of 'std::operator =='   c:\program files\microsoft visual studio 8\vc\include\list(898) : while compiling class template member function 'void std::list<_Ty>::remove(const _Ty &)'   with   [  _Ty=mem_info   ]   c:\documents and settings\jason\my documents\visual studio 2005\projects\leaky\leaky\leaky.cpp(3) : see reference to class template instantiation 'std::list<_Ty>' being compiled   with   [  _Ty=mem_info   ]c:\program files\microsoft visual studio 8\vc\include\list(901) : error C2784: 'bool std::operator ==(const std::allocator<_Ty> &,const std::allocator<_Other> &) throw()' : could not deduce template argument for 'const std::allocator<_Ty> &' from 'mem_info'   c:\program files\microsoft visual studio 8\vc\include\xmemory(174) : see declaration of 'std::operator =='c:\program files\microsoft visual studio 8\vc\include\list(901) : error C2784: 'bool std::operator ==(const std::istream_iterator<_Ty,_Elem,_Traits,_Diff> &,const std::istream_iterator<_Ty,_Elem,_Traits,_Diff> &)' : could not deduce template argument for 'const std::istream_iterator<_Ty,_Elem,_Traits,_Diff> &' from 'mem_info'   c:\program files\microsoft visual studio 8\vc\include\iterator(266) : see declaration of 'std::operator =='c:\program files\microsoft visual studio 8\vc\include\list(901) : error C2784: 'bool std::operator ==(const std::istreambuf_iterator<_Elem,_Traits> &,const std::istreambuf_iterator<_Elem,_Traits> &)' : could not deduce template argument for 'const std::istreambuf_iterator<_Elem,_Traits> &' from 'mem_info'   c:\program files\microsoft visual studio 8\vc\include\xutility(2143) : see declaration of 'std::operator =='c:\program files\microsoft visual studio 8\vc\include\list(901) : error C2784: 'bool std::operator ==(const std::reverse_iterator<_RanIt> &,const std::reverse_iterator<_RanIt2> &)' : could not deduce template argument for 'const std::reverse_iterator<_RanIt> &' from 'mem_info'   c:\program files\microsoft visual studio 8\vc\include\xutility(1826) : see declaration of 'std::operator =='c:\program files\microsoft visual studio 8\vc\include\list(901) : error C2784: 'bool std::operator ==(const std::pair<_Ty1,_Ty2> &,const std::pair<_Ty1,_Ty2> &)' : could not deduce template argument for 'const std::pair<_Ty1,_Ty2> &' from 'mem_info'   c:\program files\microsoft visual studio 8\vc\include\utility(60) : see declaration of 'std::operator =='c:\program files\microsoft visual studio 8\vc\include\list(901) : error C2676: binary '==' : 'mem_info' does not define this operator or a conversion to a type acceptable to the predefined operatorBuild Time 0:02;  What is mem_info?   ;  sorry mem_info is defined as the following:class mem_info{public:mem_info(void *mptr, size_t msize, const char* mfile, int mline) : ptr(mptr), size(msize), file(mfile), line(mline) {};// Set up the class~mem_info();// Cleanup the classvoid * GetPointer();// Get the address of the objectsize_t GetSize();// Get the size of the objectconst char* GetFile();// Get the file nameint GetLine();// Get the line numberprivate:void *ptr;// The address of the allocated memorysize_t size;// The size on the memory allocatedconst char* file;// The file in which the allocation accuredint line;// The line in which the allocation accured};;  Is there a std::list of mem_info objects someplace? Perhaps you have defined a std::list<mem_info> when you're really wanting a std::list<mem_info*> or vice versa?   