How do I fix compiler error in c declared but not referenced or never referenced

error: cc-1174 c99: WARNING File =usbuhci.c line 724 the variable "rc" was declared but never referenced. int event = 0, rc =0 Seems to compile and load fine other than these warnings but can they be fixed?

asked Apr 7, 2021 at 15:38 Peter Robertson Peter Robertson 3 5 5 bronze badges Just remove it. It's not referenced, so there is no point in keeping it. Commented Apr 7, 2021 at 15:40

2 Answers 2

The warning is telling you that rc isn't used anywhere.

You can silence the warning by removing rc .

answered Apr 7, 2021 at 15:41 219k 24 24 gold badges 234 234 silver badges 302 302 bronze badges

The best way would be removing rc but it may be difficult if rc is produced during macro expansion or by a code generator.

The traditional way to silence a compiler was casting to void . Alternatively one can use unused attribute available on GCC and CLANG compilers.

int main() < int a; int b __attribute__ ((unused)); int c; (void)a; // will warn about c but not about a and b return 0; >
answered Apr 7, 2021 at 16:02 14k 2 2 gold badges 28 28 silver badges 43 43 bronze badges

Related

Hot Network Questions

Subscribe to RSS

Question feed

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

Site design / logo © 2024 Stack Exchange Inc; user contributions licensed under CC BY-SA . rev 2024.9.4.14806