android compile problem

Previous topic - Next topic

djtoon

when i complie it dosent seem to fint my box2d.h.

the game compiles for android and pc ok.

any ideas?
10x

MrTAToad

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...

bigsofty

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.
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

djtoon

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

MrTAToad

#4
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);
}


bigsofty

#5
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?
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

MrTAToad

Or perhaps you need to activate some #define variables...

Kitty Hello

just do
Code (glbasic) Select

#ifdef ANDROID
#define sqrtf sqrt
#endif


in the box2d.h file.