I try to remove a button(I wrongly made a on event handler using wrong parent class) but i still get linker errors about the removed handler even though i remove the button from the ribbon. This is on Visual Studio 2010 Pro with a MFC C++ Project.
EDIT: For example I have a button with id BtnTargetPS3 and 2 functions
void CAboutDlg::OnTargetPS3()
{
// TODO: Add your command handler code here
}
void CTheApp::OnBtntargetps3()
{
// TODO: Add your command handler code here
}
I want the first one removed but when i do it i get linker errors as it still needs it?? When I remove that button I still get linker errors when i remove both of those functions.
Adding a message handler for an event by the wizard causes 3 changes to your source code.
1 - A message routing macro is added inside the BEGIN_MESSAGE_MAP/END_MESSAGE_MAP
block inside the .cpp
file.
2 - A code implementation of the handler function as a member function of the class, inside the .cpp
file.
3 - A prototype declaration of the handler function in the {{AFX_MSG(ClassName)/}}AFX_MSG
block inside the .h
file.
Most probably your problem is caused by deleting items 1 and 2 but forgot about item 3.