By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,983 Members | 1,627 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,983 IT Pros & Developers. It's quick & easy.

warning message regarding gcc -Wmissing-delcarations

P: 121
My code works fine with this command:
Expand|Select|Wrap|Line Numbers
  1. gcc mycode.c
It is compiled and runs just as I wanted.

But since my assignment has a specific restriction, my code must go through this:

Expand|Select|Wrap|Line Numbers
  1. gcc -pedantic-errors Wmissing-declarations -Wall -Werror -ansi mycode.c
Well, then it responds with a warning message:
gcc:Wmissing-declarations:No such file or directory.

I downloaded the pdf manual from and found this description:
-Wmissing-declarations (C only)
Warn if a global function is defined without a previous declaration. Do so even
if the definition itself provides a prototype. Use this option to detect global
functions that are not declared in header files.

I've deleted all functions, even the prototypes, and left nothing in the body of main function, but I still got the same warning message.

Okay, I give up trying to figure out why...Why?
Expand|Select|Wrap|Line Numbers
  1. #include <stdio.h>
  3. int main(int argc, char *argv[])
  4. {
  5.    printf("Blah Blah Blah!\n");
  7.    return 0;
  8. }
Expand|Select|Wrap|Line Numbers
  1. gcc -pedantic-errors Wmissing-declarations -Wall -Werror -ansi why.c
gcc says:
gcc:Wmissing-declarations:No such file or directory.

Thanks in advance.
Oct 14 '07 #1
Share this Question
Share on Google+
2 Replies

Expert 100+
P: 671
Take a very careful look at what you typed in. It's -Wmissing.... not Wmissing.

You forgot the "-".
Oct 14 '07 #2

P: 121

My lecturer made a small typo in this line:
Expand|Select|Wrap|Line Numbers
  1. gcc -pedantic-errors Wmissing-declarations -Wall -Werror -ansi
Actually it should be this:
Expand|Select|Wrap|Line Numbers
  1. gcc -pedantic-errors -Wmissing-declarations -Wall -Werror -ansi
I took it from the assignment sheet without thinking.

Pity me:(
Oct 14 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.