CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2006
    Posts
    515

    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?

  2. #2
    Join Date
    Jul 2002
    Posts
    2,543

    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.

  3. #3
    Join Date
    Aug 2006
    Posts
    515

    Re: compile error after #include <list> in MFC

    Quote Originally Posted by Alex F View Post
    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
  •  





Click Here to Expand Forum to Full Width

Featured