GP32 math.h with Gp32


StudioX64

Still Fresh
Joined
Mar 30, 2003
Messages
71
Location
UK
Website
www.studiox64.com
Is there any way of getting math.h to work when compiling with gcc to gp32. I am dev'ing my game using MS Visual Studio 6 and it compiles nicely in the GP32 sdk. Runs perfect in the GamePark emulated Win32 version of the GP32, however.... When I try to compile with gcc I get stuffed with errors. I have tracked these down to the fact I use fmod in my game. I didn't actually include "math.h" in my game, I guess MSVS just links it in with my code on it's own :) sounds like Microsoft.

My question is, how can I get gcc to use the fmod function? - or perhaps like my sin problem, someone knows the maths work-around for fmod too :) please... go on :)

Thanks in advance peeps.
 
to use the include math.h in GCC, you have to declare the lib in your makefile :
-lm

add it here :
LDBASEFLAGS = -Tlnkscript -lgpfont -lm -lgpstdlib -lgpos -lgpgraphic -lgpstdio -lgpsound -lgpmem

exemple with a makefile in miniGP32

now
#include <math>

allow u to use math function.
For sinus and cosinus use, it is better to use a trigo table pasted in another topic.
 
Thanks Pekele for your answer. I haven't had a chance to try it out yet but I definately will do. In the mean time I figured out how to work around my math usage. I was only using the fmod command, and I got around it by simply doing result=count%limit. Basically I wanted a number from 0-1000 to just return as 0-28 then wrap around. The answer was soooo stupid I just couldn't find it :)

Thanks again.
 
Back
Top