compile error after #include <list> in MFC
Code:
error C2665: 'operator new' : none of the 5 overloads could convert all the argument types
Looks like it has to do with MFC definition
Code:
#define new DEBUG_NEW
I googled it and apparently if you include <list> before this definition the problem should go away but this definition is in .cpp file and I am including <list> to .h file of the class.
How can I include STL list so I can declare a member variable of it's type in the class?
Re: compile error after #include <list> in MFC
Can you show exact code?
I think that line
#include <list>
must be before
#define new DEBUG_NEW
DEBUG_NEW redefinition must be always after all #include lines. If list is included in h-file, this h-file should be included to .cpp before DEBUG_NEW.
Re: compile error after #include <list> in MFC
Quote:
Originally Posted by
Alex F
DEBUG_NEW redefinition must be always after all #include lines. If list is included in h-file, this h-file should be included to .cpp before DEBUG_NEW.
I think this is likely the reason but the .h file is included in many other files and I just included <list> in stdafx.h which is ahead of anything else so it works. Thanks!