Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   C (http://www.programmingforums.org/forum60.html)
-   -   GCC - Warning: implicit declaration of function (http://www.programmingforums.org/showthread.php?t=10638)

darthsabbath Jul 6th, 2006 3:53 AM

GCC - Warning: implicit declaration of function
 
Hi all,

Just a question about a gcc warning I've received on a few different programs when compiling with the -Wall option...

:

warning: implicit declaration of function ‘whateverfunction()’

For example, in one program I use toupper() twice, and it only gives the warning on one line. In the same program, it gives another warning for isdigit(). The appropriate libraries are included, so I'm not sure what the deal is. Is this even something to worry about? I've Googled around and searched on here, but I cannot find an explanation (or at least one that applies to Standard C Library functions).

I know that -Wall turns on all the warnings, but I've been told that that's a good way to find errors and bugs, so I just want to make sure I'm not doing anything wrong.

BTW... I'm using Ubuntu 6.06, gcc version 4.0.3 (Ubuntu 4.0.3-1ubuntu5), and Glibc 2.3.6.

Thanks.

uman Jul 6th, 2006 4:12 AM

Post your code.

DaWei Jul 6th, 2006 6:20 AM

You're missing the include file(s) that declare the functions (their form, or prototype). C will presume that they have an integral argument and return an integer. Should this turn out to be an unwarranted assumption, you'll have trouble at the linker phase, when the correct code cannot be found.

uman Jul 6th, 2006 12:12 PM

Quote:

Originally Posted by darthsabbath
The appropriate libraries are included

which is why I implore you to post your code and all compiler errors.

DaWei Jul 6th, 2006 12:47 PM

When you say 'libraries', did you mean it, or did you mean header files. It's a typical warning for missing header files.

darthsabbath Jul 6th, 2006 12:52 PM

Okay, dumbness on my part... I had originally included ctype.h, then went back and removed it for some reason. It's back in place and working fine now. So, purely user error. Thanks for pointing me in the right direction DaWei.


All times are GMT -5. The time now is 1:38 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC