-
October 30th, 2009, 11:33 AM
#1
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?
-
October 30th, 2009, 12:04 PM
#2
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.
-
October 30th, 2009, 01:34 PM
#3
Re: compile error after #include <list> in MFC
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!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|