GIDForums  

Go Back   GIDForums > Computer Programming Forums > MS Visual C++ / MFC Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 18-Feb-2006, 11:07
coder coder is offline
New Member
 
Join Date: Jan 2006
Posts: 19
coder is on a distinguished road

A linker error


Hi all,

I added Redo to the MenuBar of a MFC application and added the corresponding variables and functions to the CMainFrame class. The added lines to the message map is like this:

CPP / C++ / C Code:
ON_COMMAND(ID_EDIT_UNDO, OnEditUndo)
	ON_UPDATE_COMMAND_UI(ID_EDIT_UNDO, OnUpdateEditUndo)
	ON_COMMAND(ID_EDIT_REDO, OnEditRedo)
	ON_UPDATE_COMMAND_UI(ID_EDIT_REDO, OnUpdateEditRedo)

After adding these lines, a linker error occured saying
" error LNK2001: unresolved external symbol "public: void __thiscall CMainFrame::OnEditRedo(void)" (?OnEditRedo@CMainFrame@@QAEXXZ)".

Also the added variables in the CMainFrame class are :
CPP / C++ / C Code:
afx_msg void OnEditUndo();
	afx_msg void OnUpdateEditUndo(CCmdUI *pCmdUI);
	afx_msg void OnEditRedo();
	afx_msg void OnUpdateEditRedo(CCmdUI *pCmdUI);

The implementations of the functions OnEditUndo, OnEditUpdateUndo, OnEditRedo and OnEditUpdateRedo are empty. It is like:
CPP / C++ / C Code:
void CMainFrame::OnEditRedo()
{
	
}

What can be the reason of the linker error after the additions to the message map.

Thanks.
Last edited by LuciWiz : 19-Feb-2006 at 06:18. Reason: Please insert your C++ code between [c++] & [/c++] tags
  #2  
Old 18-Feb-2006, 12:35
WaltP's Avatar
WaltP WaltP is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Midwest US
Posts: 3,335
WaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to all

Re: A linker error


Is this an MFC question? Shouldn't it be in the MFC forum?
__________________

During the election they said Obama could only be elected when pigs fly. Well, we currently have an epidemic of Swine Flu. Coincidence?
  #3  
Old 18-Feb-2006, 19:23
Paramesh's Avatar
Paramesh Paramesh is offline
Regular Member
 
Join Date: Sep 2005
Location: The Milky Way
Posts: 929
Paramesh is a jewel in the roughParamesh is a jewel in the roughParamesh is a jewel in the rough

Re: A linker error


I am not sure, but why dont you try this:
CPP / C++ / C Code:
public: void __thiscall CMainFrame::OnEditRedo(void) {

}

Regards,
Paramesh.
__________________

Don't walk in front of me, I may not follow.
Don't walk behind me, I may not lead.
Just walk beside me and be my friend.
  #4  
Old 19-Feb-2006, 05:22
coder coder is offline
New Member
 
Join Date: Jan 2006
Posts: 19
coder is on a distinguished road

Re: A linker error


Unfortunately, It did not worked.
  #5  
Old 19-Feb-2006, 10:50
aie0 aie0 is offline
Member
 
Join Date: Dec 2004
Posts: 246
aie0 is a jewel in the roughaie0 is a jewel in the rough

Re: A linker error


Sometimes VS goes crazy.
Try to compile every file in your project, know that this sounds dumb but it has always worked with all my unreasonable errors.
 
 

Recent GIDBlogOnce again, no time for hobbies by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Tutorial] GUI programming with FLTK dsmith FLTK Forum 10 03-Oct-2005 16:41
Winsock error when compiling FLTK 2.0 Projects mauriciorossi FLTK Forum 3 16-Aug-2005 11:18
Help with syntax errors PeteGallo C Programming Language 7 08-Aug-2005 21:30
What is "Ambigious symbol" ??*( a compilation error) small_ticket C++ Forum 2 07-Jan-2005 22:10
Can enum have same name as class? crystalattice C++ Forum 3 08-Dec-2004 17:43

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 02:36.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.