GLBasic forum

Main forum => GLBasic - en => Topic started by: djtoon on 2012-Nov-11

Title: android compile problem
Post by: djtoon on 2012-Nov-11
when i complie it dosent seem to fint my box2d.h.

the game compiles for android and pc ok.

any ideas?
10x
Title: Re: android compile problem
Post by: MrTAToad on 2012-Nov-11
Inline headers have trouble being found when compiling for Android unfortunately - I never found a way around it beyond putting everything into one gbas file...
Title: Re: android compile problem
Post by: bigsofty on 2012-Nov-11
You can link C headers via the "cmp" command line compiler options "-I" & "-include"(Google GCC command line options for more info) via the project settings on Android ro any platform for that matter.

Here's mine...

Code (glbasic) Select
-I"C:\Coding Folder\Projects\GLBasic\LIBS\Csrc" -include vectron.h

This header has other sub headers, "opengl.h" for example. I can then add openGL commands in my inline C without worrying about GL definitions.
Title: Re: android compile problem
Post by: djtoon on 2012-Nov-12
i added the command and i get this new error:
In file included from D:/puppetfull/puppets (2)/Box2D.h:64,
                 from <command-line>:0:
D:/puppetfull/puppets (2)/Source/Common/b2Settings.h: In function 'float32 b2MixFriction(float32, float32)':
D:/puppetfull/puppets (2)/Source/Common/b2Settings.h:167: error: 'sqrtf' was not declared in this scope
In file included from D:/puppetfull/puppets (2)/Source/Collision/Shapes/b2Shape.h:22,
                 from D:/puppetfull/puppets (2)/Source/Collision/Shapes/b2CircleShape.h:22,
                 from D:/puppetfull/puppets (2)/Box2D.h:66,


is it becuse box2d.h load's more C Code?

any ideas? did any of you compile android with the box2d port for glbasic ?
10x
Title: Re: android compile problem
Post by: MrTAToad on 2012-Nov-12
SQRTF is a Windows thing - I suspect Box2D that comes with GLBasic isn't compatible with Android.

You could change all occurances to sqrt but you might end up with further problems.

Or you could create your own function somewhere with the following routine :

Code (glbasic) Select
float sqrtf(float value)
{
return sqrt(value);
}

Title: Re: android compile problem
Post by: bigsofty on 2012-Nov-12
Sqrtf(), now that's a strange one, I usually only use sqrt(), so I had to look it up. Apparently it seems sqrtf() strictly will only accept floats, while sqrt() accepts all floating point types, eg. doubles etc. I think Mr T's solution should be fine but im kinda surprised that this issue hasn't appeared before when folk were doing their iOS apps with this lib?
Title: Re: android compile problem
Post by: MrTAToad on 2012-Nov-13
Or perhaps you need to activate some #define variables...
Title: Re: android compile problem
Post by: Kitty Hello on 2012-Nov-14
just do
Code (glbasic) Select

#ifdef ANDROID
#define sqrtf sqrt
#endif


in the box2d.h file.