Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jul 6th, 2006, 3:53 AM   #1
darthsabbath
Newbie
 
Join Date: Dec 2005
Posts: 15
Rep Power: 0 darthsabbath is on a distinguished road
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.
darthsabbath is offline   Reply With Quote
Old Jul 6th, 2006, 4:12 AM   #2
uman
Expert Programmer
 
Join Date: Dec 2004
Posts: 794
Rep Power: 4 uman is on a distinguished road
Post your code.
__________________
Few people deserve to be compared to (Rush) Limbaugh, most of them were convicted at the Nuremburg trials.
--WilliamSChips on Slashdot
uman is offline   Reply With Quote
Old Jul 6th, 2006, 6:20 AM   #3
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
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.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Jul 6th, 2006, 12:12 PM   #4
uman
Expert Programmer
 
Join Date: Dec 2004
Posts: 794
Rep Power: 4 uman is on a distinguished road
Quote:
Originally Posted by darthsabbath
The appropriate libraries are included
which is why I implore you to post your code and all compiler errors.
__________________
Few people deserve to be compared to (Rush) Limbaugh, most of them were convicted at the Nuremburg trials.
--WilliamSChips on Slashdot
uman is offline   Reply With Quote
Old Jul 6th, 2006, 12:47 PM   #5
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
When you say 'libraries', did you mean it, or did you mean header files. It's a typical warning for missing header files.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Jul 6th, 2006, 12:52 PM   #6
darthsabbath
Newbie
 
Join Date: Dec 2005
Posts: 15
Rep Power: 0 darthsabbath is on a distinguished road
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.
darthsabbath is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 1:55 PM.

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