I have been converting a large application to MFC feature pack over the last month using Visual Studio 2015. I was finished with development and debugging and ready to create a release build. To my horror, the release build had a severe run-time error which I traced using AfxMessageBoxes to the point in the code where the menu bar is created.
CMFCMenuBar m_wndMenuBar;
if (!m_wndMenuBar.Create(this))
{
AfxMessageBox(_T("Failed to create menubar"));
TRACE0("Failed to create menubar\n");
return -1; // fail to create
}
I moved the status bar creation and toolbar creation ahead of the menu bar creation and it still failed at menu bar creation. I turned off optimization in the release build. The debug build works fine.
I have never encountered a release build problem like this before and am at a loss on how to proceed. I could use some advice.