4 years, 5 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

4 years, 5 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.

Accepted Answer
4 years, 5 months ago.

Come on!! You have to be more specific!!