Welcome to the Builder Academy

Question some mud_log issues

More
05 Aug 2012 00:52 #534 by bakarus
some mud_log issues was created by bakarus
I patched in Vatiken's Group code, and hand patched in Jamdog's Clan code that was made for 3.61.

I managed to "fix" the errors i found and this last one I just can't get to work.

The errors I'm getting are these:
Code:
In file included from /usr/include/math.h:71, from utils.c:26: /usr/include/bits/mathcalls.h:110: error: conflicting types for 'basic_mud_log' utils.h:39: error: previous declaration of 'basic_mud_log' was here utils.c: In function 'rand_number': utils.c:40: error: incompatible type for argument 1 of 'basic_mud_log' utils.c:40: error: too many arguments to function 'basic_mud_log' utils.c: In function 'rand_float': utils.c:64: error: incompatible type for argument 1 of 'basic_mud_log' utils.c:64: error: too many arguments to function 'basic_mud_log' utils.c: In function 'touch': utils.c:280: error: incompatible type for argument 1 of 'basic_mud_log' utils.c:280: error: too many arguments to function 'basic_mud_log' utils.c: In function 'mudlog': utils.c:329: error: incompatible type for argument 1 of 'basic_mud_log' utils.c:329: error: too many arguments to function 'basic_mud_log' utils.c:329: error: incompatible type for argument 1 of 'basic_mud_log' utils.c:329: error: too many arguments to function 'basic_mud_log' utils.c:332: error: incompatible type for argument 1 of 'basic_mud_log' utils.c:332: error: too many arguments to function 'basic_mud_log' utils.c:332: error: incompatible type for argument 1 of 'basic_mud_log' utils.c:332: error: too many arguments to function 'basic_mud_log' utils.c:332: error: incompatible type for argument 1 of 'basic_mud_log' utils.c:332: error: too many arguments to function 'basic_mud_log' utils.c:332: error: incompatible type for argument 1 of 'basic_mud_log' utils.c:332: error: too many arguments to function 'basic_mud_log' utils.c: In function 'add_follower': utils.c:667: error: incompatible type for argument 1 of 'basic_mud_log' utils.c:667: error: too many arguments to function 'basic_mud_log' utils.c:674: error: incompatible type for argument 1 of 'basic_mud_log' utils.c:674: error: too many arguments to function 'basic_mud_log' utils.c:674: error: incompatible type for argument 1 of 'basic_mud_log' utils.c:674: error: too many arguments to function 'basic_mud_log' utils.c: In function 'get_filename': utils.c:733: error: incompatible type for argument 1 of 'basic_mud_log' utils.c:733: error: too many arguments to function 'basic_mud_log' utils.c: In function 'core_dump_real': utils.c:814: error: incompatible type for argument 1 of 'basic_mud_log' utils.c:814: error: too many arguments to function 'basic_mud_log' utils.c: In function 'room_is_dark': utils.c:867: error: incompatible type for argument 1 of 'basic_mud_log' utils.c:867: error: too many arguments to function 'basic_mud_log' utils.c: In function 'levenshtein_distance': utils.c:900: error: incompatible type for argument 1 of 'basic_mud_log' utils.c:900: error: too many arguments to function 'basic_mud_log' utils.c:903: error: incompatible type for argument 1 of 'basic_mud_log' utils.c:903: error: too many arguments to function 'basic_mud_log' utils.c: In function 'char_from_furniture': utils.c:937: error: incompatible type for argument 1 of 'basic_mud_log' utils.c:944: error: incompatible type for argument 1 of 'basic_mud_log' utils.c: In function 'column_list': utils.c:1000: error: incompatible type for argument 1 of 'basic_mud_log' utils.c:1000: error: too many arguments to function 'basic_mud_log' utils.c:1013: error: incompatible type for argument 1 of 'basic_mud_log' utils.c:1013: error: too many arguments to function 'basic_mud_log' utils.c:1018: error: incompatible type for argument 1 of 'basic_mud_log' utils.c:1018: error: too many arguments to function 'basic_mud_log' make[1]: *** [utils.o] Error 1

From good advice I usually start with the top of the list, and work down, sometimes the one at the top causes the others, so here is the code lines for the first error:

Utils.h
Code:
/* Public functions made available from utils.c. Documentation for all functions * are made available with the function definition. */ void basic_mud_log(const char *format, ...) __attribute__ ((format (printf, 1, 2))); <-- Line 39 void basic_mud_vlog(const char *format, va_list args);

Utils.c -- line 40 is the log call
Code:
int rand_number(int from, int to) { /* error checking in case people call this incorrectly */ if (from > to) { int tmp = from; from = to; to = tmp; log("SYSERR: rand_number() should be called with lowest, then highest. (%d, %d), not (%d, %d).", from, to, to, from); }


Thanks in advance for any help

Please Log in or Create an account to join the conversation.

More
05 Aug 2012 03:14 #535 by Vatiken
Replied by Vatiken on topic Re: some mud_log issues
Gonna take a stab here and say you are probably having an issue due not to basic_mud_log() but with regards to the define in utils.h which states:
Code:
#define log basic_mud_log

log() being a function defined in math.h is thus duplicated and hence the errors and warnings. If I'm right then your two options are to either remove that define and change any log() found in the code to basic_mud_log(), OR, remove math.h from whatever header file you included it in, AND if necessary, write your own functions for the purposes that math.h was included.

tbaMUD developer/programmer
The following user(s) said Thank You: bakarus

Please Log in or Create an account to join the conversation.

More
05 Aug 2012 06:43 #537 by bakarus
Replied by bakarus on topic Re: some mud_log issues
I believe the math.h stuff might have been in there for the floating point stuff from Jamdog's clan code. I'm not sure which would be easier, writing my own floating point calculation function or renaming the log function to something else, then changing every instance of that throughout the entire code.

Please Log in or Create an account to join the conversation.

More
05 Aug 2012 17:32 #539 by Vatiken
Replied by Vatiken on topic Re: some mud_log issues
Perhaps a re-write of the reason that those functions are needed?

tbaMUD developer/programmer

Please Log in or Create an account to join the conversation.

More
05 Aug 2012 17:54 #540 by bakarus
Replied by bakarus on topic Re: some mud_log issues
thats what i ended up doing, swapped the float for an easier to use int.

Please Log in or Create an account to join the conversation.

Time to create page: 0.194 seconds