[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  SMAUG
. -> [Folder]  Compiling the server
. . -> [Subject]  Implicit declarations?

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Implicit declarations?

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page


Posted by Mixoplix   (8 posts)  [Biography] bio
Date Tue 06 Aug 2002 12:28 AM (UTC)  quote  ]
Message
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
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Tue 06 Aug 2002 01:00 AM (UTC)  quote  ]
Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


1,104 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]