/vmg option causes OnCreate() to not get called


  • Our project has multiple inheritance throughout and our message maps generate compiler warning C4407.  I have tried compiling with /vmg and /vmv options per the documentation and the warnings have gone away.  Unfortunately, some of the child windows on my main frame no longer have OnCreate() called.  This of course causes the program to crash.  I have reproduced this problem by creating a sample MFC multi view project and added an OnCreate() to my derived CView class.  Sure enough, OnCreate() does not get called when it is compiled with /vmg /vmv option.  Remove the option and OnCreate() gets called correctly.  Has anyone enountered this problem?  Is there a workaround?  I am out of ideas.

    PS: I should add that I am porting this project from VS2003 to VS2008.  On VS2003, there is no warning and it appears to handle the method pointers properly all the time.
    • Edited by Ralph Stefan Friday, July 18, 2008 3:00 PM More details
    Thursday, July 17, 2008 8:41 PM


  • Unfortunately that didn't work for me.  I had to put
    #pragma pointers_to_members( full_generality, virtual_inheritance )
    before all my message map declarations which generated the warnings.  Fortunately none of those maps had OnCreate() in them. Otherwise I would have had to restructure some of our classes.  So far, so good, although I haven't tested everything.
    • Proposed as answer by Ted_ Wednesday, July 23, 2008 12:42 AM
    • Marked as answer by Yan-Fei Wei Thursday, July 24, 2008 7:06 AM
    Tuesday, July 22, 2008 7:12 PM

All replies