03-10-2009, 12:42 AM | #1 |
New Member
Join Date: Mar 2009
Posts: 20
|
Having a few issues that need fixed before I can compile WHO CAN HELP?:>
any help or suggestions appreciated can you tell me whats with with these arguements diku code in C
val=(int)(100.0*(0.35*exp(0.055*(double)(GetMaxLev el(ch)-GetMaxLevel(vict))))) that is the first one, says when it referance "exp" (so how do I fix it?) ePart = ((double)(skill)/90.0) * EVEN_CHANCE * exp(SCALER * (double)(diff)); this is the second one, it also has the same error message. thanks any help would be greatly appreciated reach me here or on windows live |
03-10-2009, 06:23 PM | #2 |
Member
Join Date: Nov 2003
Posts: 50
|
Re: Having a few issues that need fixed before I can compile WHO CAN HELP?:>
Is there a 'learning to code' forum? It's been quite a few years, but I'll have a stab at it:
val=(int)(100.0*(0.35*exp(0.055*(double)(GetMaxLev el(ch)-GetMaxLevel(vict))))) The victim's level is subtracted from the caster's level: (GetMaxLevel(ch)-GetMaxLevel(vict)) then type-cast into a type double (double) then multiplied by (0.055* ....) the result is then passed to the exp function, I think exp(...) the return value from the exp function is then multiplied by 0.35, then by 100 finally, the value is type-cast into an INT and assigned to the variable 'val' After all that, the brackets seem correct and although you have a space in 'GetMaxLevel', your vague description of the error implies that a function isn't getting the right arguments. We'd need the error message text to know which function for sure. ePart = ((double)(skill)/90.0) * EVEN_CHANCE * exp(SCALER * (double)(diff)); Given that the only function in both lines of code is exp(), I'm guessing that the number of type double that you're passing is either incorrect or that there is an additional parameter required. Check the function definition to see what parameters the code expects to be passed. |
03-10-2009, 07:48 PM | #3 |
New Member
Join Date: Mar 2009
Posts: 20
|
Re: Having a few issues that need fixed before I can compile WHO CAN HELP?:>
Thanks for the imput, this is the exact read out I am getting. hopfully not to spammy
test ! -f dmserver || mv dmserver dms.old gcc -g -pipe -DUSE_profile=0 -o dmserver main.o Heap.o Opinion.o Sound.o Trap.o act.comm.o act.info.o act.move.o act.obj1.o act.obj2.o act.offensive.o act.other.o act.social.o act.wizard.o array.o board.o casino.o channels.o cmdtab.o comm.o constants.o db.o db.mobile.o db.object.o db.player.o db.relate.o db.utility.o db.world.o editor.o engine.o enginit.o englogic.o engmobs.o engprecall.o events.o fight.o find.o handler.o hash.o hero.o interpreter.o limits.o list.o magic.o magicutils.o memory.o mobact.o modify.o multiclass.o newsaves.o page.o parse.o periodic.o recept.o ringlog.o sblock.o shop.o signals.o skills.o smart_mobs.o block.o spec_assign.o spec_astral.o spec_breath.o spec_dm.o spec_mobs.o spec_obj.o spec_rooms.o spec_utils.o spell_parser.o spells.o spelltab.o sstring.o statistic.o stats.o strstr.o track.o utility.o util_num.o util_str.o weather.o whod.o -lcrypt englogic.o: In function `logic_new_skill_saves': /home/sargas/src/englogic.c:101: undefined reference to `exp' newsaves.o: In function `NewSkillSave': /home/sargas/src/newsaves.c:43: undefined reference to `exp' collect2: ld returned 1 exit status make: *** [dmserver] Error 1 does that help? thanks |
03-10-2009, 07:54 PM | #4 |
Member
Join Date: Nov 2003
Posts: 50
|
Re: Having a few issues that need fixed before I can compile WHO CAN HELP?:>
Find where the exp() function is defined, then make sure your sources files have access to it during compilation.
I don't recall all the scope and include rules for gcc, but I'm sure that - assuming such a function as exp() exists - all you need to do is check the scope of includes, maybe include path, or maybe even the order(?) of files that are included, to ensure your englogic.c code is correctly referring to this function. Same goes for the newsaves.c code, too. Of course, there's a chance the function was renamed some time in the past and these two source files are simply referring to the old name for it: either way, find the exp function, save the world. |
03-12-2009, 12:11 AM | #5 |
Member
Join Date: Oct 2008
Home MUD: tharel.net
Posts: 36
|
Re: Having a few issues that need fixed before I can compile WHO CAN HELP?:>
exp() is part of the math static library. The final compilation step needs to contain "-lm" to link in that library. So where it has -lcrypt in the makefile, change it to: -lcrypt -lm
Last edited by Pymeus : 03-12-2009 at 12:22 AM. |