|11-08-2002, 07:47 PM||#1|
I am trying to get the double exp code in and ran into this problem!
act_wiz.c: In function `do_doublexp':
act_wiz.c:5797: `doublexp' undeclared (first use in this function)
act_wiz.c:5797: (Each undeclared identifier is reported only once
act_wiz.c:5797: for each function it appears in.)
act_wiz.c:5809: warning: implicit declaration of function `do_announce'
make: *** [act_wiz.o] Error 1
Could someone explain as to what i am looking for? So i can learn.
|11-08-2002, 09:24 PM||#2|
Join Date: May 2002
Your problem is in line 5797 of act_wiz.c.
The word "doublexp" is not being recognised by the compiler.
This usually arises because you are using a function that is "not known" at this point - generally because it lies in a different file.
This problem is solved by "declaring" that function in the main header file (merc.h, mud.h, or whatever your version is called) - this effectively tells the compiler "Don't worry about it now - it'll get sorted out later (at linking)".
Alternatively the function you are referring to might occur later in the same file - similar solution, declare it which means "Don't worry about it, it will get fixed later".
Declaring means just entering the opening line of the function, including the parameter/argument types, followed by a semicolon - eg:
void my_function(int, char);
Thus the problem usually arises because the "other" function has not been declared in the header file, or an out-of-date version of the header file is used somewhere in the code (ie you should have ensured it was all updated by using "make clean"), or possibly the other file where it is actually found hasn't been included (ie the "new" file hasn't been added to the list of .o files in the makefile).
However, it's also worth checking if you have a typo on that line - ie it's looking for the "wrong thing" in some way.
If none of these works, post the offending line (with a few lines either side).
|11-12-2002, 10:35 AM||#3|
Join Date: Apr 2002
Helps if you tell us which code base. I see act_wiz.c I'm going out on a limb and say a Diku/Merc flavor.
Silly me when I declare a fuction I use the args var
void check_sex args( ( CHAR_DATA *ch) );
Now the next question is. What is doubleexp inside the do_doublexp function? Is it a var or is it a function call? if its a var then you'll have to define it at the begin of the function at the very least or in a loop/if statment.
With your second error you trying to call the function
do_announce, again I'm going to assume your using Merc/Diku/Rom/Rot and the function should be
do_announcement. How ever this function just turns the announcements on and off. If you wanted to announce something to the whole mud, use the announcement function.