Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
6 years, 7 months ago.
how do I fix this problem?
Warning: Variable "hours" was declared but never referenced in "main.cpp", Line: 9, Col: 10
2 Answers
6 years, 7 months ago.
1. People can't debug your code if you don't post your code.
2. It's only a warning you can ignore it.
3. In this specific case the warning is in very easy to understand English: the variable "hours" was declared but never referenced. On line 9 you have defined a variable called hours but then you never use that variable in your code. It is warning you about this because this doesn't make sense, why would someone add a line that takes up memory but doesn't do anything. To get rid of the warning remove the declaration of hours from line 9 of main.cpp.