Implicit declarations?

Posted by Mixoplix on Tue 06 Aug 2002 12:28 AM — 2 posts, 11,094 views.

#0
What exactly would an error message stating:

implicit declaration of function 'blah blah blah' mean?

I get a few of those every now and than and was just wondering what it meant. Thanks

Mixoplix
Australia Forum Administrator #1
It is caused by calling a function that doesn't have a function prototype, or which hasn't been declared earlier (in full).

Usually this is because there is a missing xx.h file at the start of the source file. If it is an inbuilt function (eg. printf) then look at the help for that and include the appropriate file (eg. #include <stdio.h>).

If it is a SMAUG function do a grep to find the appropriate .h file, and include that. If you can't find that, find the actual declaration for the function, and do a prototype at the start of the file where it is called. Just picking an example at random, say the function in question was "do_mset" then you would find "do_mset" in file build.c, which is:


void do_mset( CHAR_DATA *ch, char *argument )
{
    char arg1 [MAX_INPUT_LENGTH];
    char arg2 [MAX_INPUT_LENGTH];

... and so on ...


Then, take the declaration line and add a semicolon, like this:


void do_mset( CHAR_DATA *ch, char *argument );


This is then a "function prototype" which you can then put in another source file, before where it is used.