compiling errors using vc6

hey there!

first of all: thank you for creating this framework! it seems to be pretty useful! 🙂

i tried to use your stuff in visual studio 6.0. i created an empty console application and inserted your "hello world"-code. i set the include path to your box2d-include directory, but when i try to compile i get a load of errors - all located in b2math.h:

Quote:
d:\silver\zodiac\box2d_v1.4.2\box2d\source\common\b2math.h(276) : error C2782: 'T __cdecl b2Min(T,T)' : template parameter 'T' is ambiguous
could be 'struct b2Vec2'
or 'const struct b2Vec2 &'
d:\silver\zodiac\box2d_v1.4.2\box2d\source\common\b2math.h(276) : error C2785: 'T __cdecl b2Min(T,T)' and 'struct b2Vec2 __cdecl b2Min(const struct b2Vec2 &,const struct b2Vec2 &)' have different return types
d:\silver\zodiac\box2d_v1.4.2\box2d\source\common\b2math.h(270) : see declaration of 'b2Min'
d:\silver\zodiac\box2d_v1.4.2\box2d\source\common\b2math.h(290) : error C2782: 'T __cdecl b2Max(T,T)' : template parameter 'T' is ambiguous
could be 'struct b2Vec2'
or 'const struct b2Vec2 &'
d:\silver\zodiac\box2d_v1.4.2\box2d\source\common\b2math.h(290) : error C2785: 'T __cdecl b2Max(T,T)' and 'struct b2Vec2 __cdecl b2Max(const struct b2Vec2 &,const struct b2Vec2 &)' have different return types
d:\silver\zodiac\box2d_v1.4.2\box2d\source\common\b2math.h(284) : see declaration of 'b2Max'
d:\silver\zodiac\box2d_v1.4.2\box2d\source\common\b2math.h(304) : error C2782: 'T __cdecl b2Clamp(T,T,T)' : template parameter 'T' is ambiguous
could be 'struct b2Vec2'
or 'const struct b2Vec2 &'
d:\silver\zodiac\box2d_v1.4.2\box2d\source\common\b2math.h(304) : error C2785: 'T __cdecl b2Clamp(T,T,T)' and 'struct b2Vec2 __cdecl b2Clamp(const struct b2Vec2 &,const struct b2Vec2 &,const struct b2Vec2 &)' have different return types
d:\silver\zodiac\box2d_v1.4.2\box2d\source\common\b2math.h(298) : see declaration of 'b2Clamp'



any insights would be helpful! 🙂
seems like projects in visual studio 6.0 don't compile if there are functions with the same name in a class.

i don't know if this is the best way, but i just replaced a few things in b2math.h

Quote:
inline b2Vec2 b2Max(const b2Vec2& a, const b2Vec2& b)
inline b2Vec2 b2Min(const b2Vec2& a, const b2Vec2& b)
inline b2Vec2 b2Clamp(const b2Vec2& a, const b2Vec2& low, const b2Vec2& high)


became

Quote:
inline b2Vec2 b2MaxVec(const b2Vec2& a, const b2Vec2& b)
inline b2Vec2 b2MinVec(const b2Vec2& a, const b2Vec2& b)
inline b2Vec2 b2ClampVec(const b2Vec2& a, const b2Vec2& low, const b2Vec2& high)


(of course i edited all calls using inline-functions with b2vec2-objects)

now it compiles, but i guess i'm still missing some .lib-files, because now i get unresolved externals on the b2world-object...
Sorry, I'm not supporting vc6. You can download free versions of vc8 and vc9. vc9 comes with the platform SDK.
Also codeblocks works great!
Free like vc8..
Mike
Erin Catto wrote:
Sorry, I'm not supporting vc6. You can download free versions of vc8 and vc9. vc9 comes with the platform SDK.

no problem. i rebuilt box2d using vc6 and now i'm using the created library and it works. 😉
Hey thats great!
How did you get it working? I wouldn't mind going back to
VS6. Codeblocks is nice but i still prefer the VS6 environment.
Mike
mike950 wrote:
Hey thats great!
How did you get it working? I wouldn't mind going back to
VS6. Codeblocks is nice but i still prefer the VS6 environment.
Mike

i created a new library-project, added all the files of box2d (header and all the source files), did the above mentioned changes in 2dmath.h, compiled and used the created .lib-file in my project. works! 🙂
Excellent! Thanks..
I'm switching to vs6 now 🙂
Mike
Hi, I just wanted to point out that an easier way is to just edit the template functions like so:

Code:
template <typename T>
//inline T b2Min(T a, T b)
inline T b2Min(const T &a, const T &b)

template <typename T>
//inline T b2Max(T a, T b)
inline T b2Max(const T &a, const T &b)

template <typename T>
//inline T b2Clamp(T a, T low, T high)
inline T b2Clamp(const T &a, const T &low, const T &high)


Now you don't have to edit all the code that calls these functions. Hope that helps someone!

-j
Thanks!
What a great tip!
Mike

Original thread: https://box2d.org/forum/viewtopic.php?t=106