这是函数内容:
void CFindFileDlg::OnButton1() 
{
UpdateData(true);
CString str,title[1000],name[1000],root[1000];
CFileFind finder;
char *pw;
CString n,Strpath,path;
int i=0;
Strpath=m_EDIT2;
    Strpath+= _T("\\*.*");
    BOOL bWorking = finder.FindFile(Strpath);
 while (bWorking)  
 {    
      bWorking = finder.FindNextFile();
  if (finder.IsDots())
         continue;
  if(finder.IsDirectory())                           //  搜索 //
  { path=finder.GetFilePath();
    Recurse(path);
  }//findsubdir
  else{
  str=finder.GetFileTitle();   
  pw=strstr(str,m_EDIT1);     //比较字符串;
  if(pw!=NULL) {  i++;if(i<1000){
      name[i]=finder.GetFileName();
      title[i]=finder.GetFileTitle();
      root[i]=finder.GetRoot();}
  }
  else 
  SetDlgItemText(IDC_EDIT3,"找不到该文件");
    }   
 }
 if(i>0) 
      { 
    n="";
for(;i>0;i--)
{n=n+name[i]+"||";}
        SetDlgItemText(IDC_EDIT3,n);
SetDlgItemText(IDC_EDIT2,root[i]);
}
 else {   SetDlgItemText(IDC_EDIT2,"");
  SetDlgItemText(IDC_EDIT3,"找不到该文件");
  }
}

解决方案 »

  1.   

    Compiler Error C2601
    'function name' : local function definitions are illegalAn attempt was made to define a function within a function.The following is an example that will generate this error:int main()
    {
       int i = 0;   int funcname(int j)
       {
          j++;
          return j;
       }
       
       i = funcname(i);
       return 0;
    }If you move the function into the global space, outside the main() function, the program will compile and run.
      

  2.   

    你在头文件中写定义了吗?是不是和classwizard重了
      

  3.   

    建议你把该函数内容copy下来,然后删掉该函数及其声明,然后用ClassWizard重新生成该函数,再把函数内容paste到函数中,应该就可以。