help fixing error C2065: 'Switch' : undeclared identifier
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: help fixing error C2065: 'Switch' : undeclared identifier

  1. #1
    Join Date
    Apr 2005
    Posts
    76

    help fixing error C2065: 'Switch' : undeclared identifier

    Hi all . could any one help me fix the following errors when using switch.Thanks


    Errors:
    Code:
    --------------------Configuration: timers - Win32 Debug--------------------
    Compiling...
    timersDlg.cpp
    C:\visualC\timers\timersDlg.cpp(219) : error C2065: 'Switch' : undeclared identifier
    C:\visualC\timers\timersDlg.cpp(220) : error C2143: syntax error : missing ';' before '{'
    C:\visualC\timers\timersDlg.cpp(222) : error C2046: illegal case
    C:\visualC\timers\timersDlg.cpp(227) : error C2043: illegal break
    C:\visualC\timers\timersDlg.cpp(228) : error C2046: illegal case
    C:\visualC\timers\timersDlg.cpp(232) : error C2043: illegal break
    Error executing cl.exe.
    
    timers.exe - 6 error(s), 0 warning(s)

    visual c++ code:

    Code:
    void CTimersDlg::OnTimer(UINT nIDEvent) 
    {
    	// TODO: Add your message handler code here and/or call default
    
    
    	CTime curTime = CTime::GetCurrentTime();
    
    Switch(nIDEvent)
    {
    
    case ID_CLOCK_TIMER:
      
    	     m_sTime.Format("%d:%d:%d",curTime.GetHour(),
             curTime.GetMinute(),
             curTime.GetSecond());
      break;
    case ID_COUNT_TIMER:
      
    	     m_iCount++;
             m_sCount.Format("%d", m_iCount);
      break;
    }
    
    UpdateData(FALSE);
    
    //END OF MY MYCODE
    	
    	CDialog::OnTimer(nIDEvent);
    }

  2. #2
    Join Date
    Aug 2002
    Location
    Madrid
    Posts
    4,588

    Re: help fixing error C2065: 'Switch' : undeclared identifier

    it's "switch" in lower case
    Get this small utility to do basic syntax highlighting in vBulletin forums (like Codeguru) easily.
    Supports C++ and VB out of the box, but can be configured for other languages.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center