Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 21994

How do I get rid of the unused parameter warning in C with gcc 4.8.4 [-Wunused-parameter] [duplicate]

$
0
0

Using gcc 4.8.4 -Wall -Wextra -Wpedantic. I want to use argv for the executable name and have no need for argc.

If I do

int main(int argc, char *argv[])

I get this warning:

abc.c:5:14: warning: unused parameter ‘argc’ [-Wunused-parameter]

In the past I have just done

int main(int, char *argv[])

to get rid of the warning, but that may have been C++. Now I get an error:

abc.c:5:1: error: parameter name omitted

Is there a way to access argv and not get a warning for not accessing argc (with gcc warnings turned on)?


Viewing all articles
Browse latest Browse all 21994

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>