0
Please help
Why it's give warning https://sololearn.com/compiler-playground/cj5M4HZNyj03/?ref=app Result -> $ gcc 3.c -W -Wall -Wextra -W#warnings 3.c:26:31: warning: variable 'options' is not needed and will not be emitted [-Wunneeded-internal-declaration] 26 static const struct sc_option options[] = { | ^~~~~~~ 1 warning generated.
7 Respostas
+ 4
what is option> in line 42?
prinft() is not closed and there is no ; in the end of the line.
main does not return anything in your code.
+ 1
do you mean "options" in the printf()?
+ 1
Line 25 - ' options[ ] ' error
After run is say ->
Variable 'options' is not needed
and will not be emitted
+ 1
line 42. options. with s. do you mean to write options there?
+ 1
Yaniv B You're using the ARRAY_LEN macro with an array that's not actually used in this code. I think this may lead to your compiler optimizing away the unused array and coz raising a warning. Try this code that I attach below, it iterates over the 'options[]' array in the main function and prints each option as well, and also ensuring that the array is used in the code to resolve the warning.
Here, in the code I use a loop, the for loop iterates over each element of the 'option[]' array and lastly print the index with the corresponding 'longopt' value for each option. Inform me is it solved or show any warning!?
https://sololearn.com/compiler-playground/crLCzjYjJsfU/?ref=app
0
It as in my local machine, it's because copy&paste.
0
I did here and on my local
but Result different , here on solo
no error & warning
in my local gcc say warning on -> 'options[ ]' not needed