我有一组表示颜色的菜单项,比如RED\YELLOW\BLUE等, 因此在程序中使用了ON_COMMAND_RANGE来处理菜单命令,但是却出现了如下错误:ChildView.obj : error LNK2001: unresolved external symbol "protected: void __thiscall CChildView::OnColor(unsigned int)" (?OnColor@CChildView@@IAEXI@Z)是什么原因?菜单的ID我已检查过,是按顺序排列的.

解决方案 »

  1.   

    呵呵,OnColor实现了吗??
    好像是这种错吧
      

  2.   

    OnColor 函数未实现出现的链接错误
      

  3.   

    Agree with the viewpoint all giving above,what's more,please make sure that OnColor(UINT nID) function must have the string "afx_msg" in the front while U declare in the correct position of the head file.Sorry,this computer doesn't install the WuBi Chinese inputer method.
      

  4.   

    请问一下楼上,必须要加"afx_msg"吗,因为我曾听说这个关键字没有作用,是微软用做保留的。
    这个问题我觉得还是因为void OnColor(UINT id)没有实现。楼主如果已经写了这个函数,那就检查一下一些细节地方,比如参数类型对不对,在.cpp文件中是否把void CChildView::OnColor(UINT id)写成了void OnColor(UINT id)等等