using timers
-
I'm looking at "Sams Teach Yourself Visual C++ 6 in 21 Days" and for the code on page 78, I get the following error for line 23's code in the book: --------------------Configuration: Timers - Win32 Debug-------------------- Compiling... TimersDlg.cpp C:\WINDOWS\Desktop\Rajveer\Timers\TimersDlg.cpp(203) : error C2196: case value '1' already used Error executing cl.exe. TimersDlg.obj - 1 error(s), 0 warning(s) I checked all my code for that entire project and I've typed it exactly as the book. So what is wrong?
-
I'm looking at "Sams Teach Yourself Visual C++ 6 in 21 Days" and for the code on page 78, I get the following error for line 23's code in the book: --------------------Configuration: Timers - Win32 Debug-------------------- Compiling... TimersDlg.cpp C:\WINDOWS\Desktop\Rajveer\Timers\TimersDlg.cpp(203) : error C2196: case value '1' already used Error executing cl.exe. TimersDlg.obj - 1 error(s), 0 warning(s) I checked all my code for that entire project and I've typed it exactly as the book. So what is wrong?
Um... hard to say without seeing some code. /ravi "There is always one more bug..." ravib@ravib.com http://www.ravib.com
-
Um... hard to say without seeing some code. /ravi "There is always one more bug..." ravib@ravib.com http://www.ravib.com
Ravi Bhavnani wrote: hard to say without seeing some code The operative word here is "some" I guess. I mean we dont want someone posting an entire project over here huh? Nish Sonork ID 100.9786 voidmain www.busterboy.org If you don't find me on CP, I'll be at Bob's HungOut
-
I'm looking at "Sams Teach Yourself Visual C++ 6 in 21 Days" and for the code on page 78, I get the following error for line 23's code in the book: --------------------Configuration: Timers - Win32 Debug-------------------- Compiling... TimersDlg.cpp C:\WINDOWS\Desktop\Rajveer\Timers\TimersDlg.cpp(203) : error C2196: case value '1' already used Error executing cl.exe. TimersDlg.obj - 1 error(s), 0 warning(s) I checked all my code for that entire project and I've typed it exactly as the book. So what is wrong?
Post the code snippet for the function within which you get this error. Nish Sonork ID 100.9786 voidmain www.busterboy.org If you don't find me on CP, I'll be at Bob's HungOut
-
Ravi Bhavnani wrote: hard to say without seeing some code The operative word here is "some" I guess. I mean we dont want someone posting an entire project over here huh? Nish Sonork ID 100.9786 voidmain www.busterboy.org If you don't find me on CP, I'll be at Bob's HungOut
Not again. :) J
-
Not again. :) J
:-) yeah. Not so soon anyway :-) Nish Sonork ID 100.9786 voidmain www.busterboy.org If you don't find me on CP, I'll be at Bob's HungOut
-
I'm looking at "Sams Teach Yourself Visual C++ 6 in 21 Days" and for the code on page 78, I get the following error for line 23's code in the book: --------------------Configuration: Timers - Win32 Debug-------------------- Compiling... TimersDlg.cpp C:\WINDOWS\Desktop\Rajveer\Timers\TimersDlg.cpp(203) : error C2196: case value '1' already used Error executing cl.exe. TimersDlg.obj - 1 error(s), 0 warning(s) I checked all my code for that entire project and I've typed it exactly as the book. So what is wrong?
[ Please don't send me email - instead reply to the forum. Thanks! ] Rajveer wrote: Here is the function that gave the error. I have marked the line where the error occured. And i've pasted the error message below.
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: ///THE ERROR OCCURED ON THIS LINE!!!/// m\_iCount++; m\_sCount.Format("%d", m\_iCount); break; } UpdateData(FALSE); CDialog::OnTimer(nIDEvent);
}
You can't have 2 cases (i.e. 2 occurences of ID_CLOCK_TIMER) in the same switch statement. Looks like you made a simple copy/paste error. /ravi "There is always one more bug..." ravib@ravib.com http://www.ravib.com
-
[ Please don't send me email - instead reply to the forum. Thanks! ] Rajveer wrote: Here is the function that gave the error. I have marked the line where the error occured. And i've pasted the error message below.
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: ///THE ERROR OCCURED ON THIS LINE!!!/// m\_iCount++; m\_sCount.Format("%d", m\_iCount); break; } UpdateData(FALSE); CDialog::OnTimer(nIDEvent);
}
You can't have 2 cases (i.e. 2 occurences of ID_CLOCK_TIMER) in the same switch statement. Looks like you made a simple copy/paste error. /ravi "There is always one more bug..." ravib@ravib.com http://www.ravib.com
-
He doesn't - he as ID_CLOCK_TIMER and ID_COUNT_TIMER but they both seem to have the same value. A vast majority of our imports comes from outside the country. George W. Bush
Ooops! Sorry, my dyslexia got the better of me. :) /ravi "There is always one more bug..." http://www.ravib.com ravib@ravib.com