Casting errors while building on Windows us

Casting errors while building on Windows us

Postby jacksiroke » 31 Mar 2020, 01:45

I have followed all the steps of building SR on Windows using VS 2010 as outlined here on http://stuntrally.tuxfamily.org/wiki/do ... =compilevs successfully except for the last part of building the game itself.

I keep getting this error:

{l Code}: {l Select All Code}
1>..\source\vdrift\collision_world.cpp(30): error C2440: 'initializing' : cannot convert from 'void *' to 'const btCollisionObject *'
1>          Conversion from 'void*' to pointer to non-'void' requires an explicit cast
1>..\source\vdrift\collision_world.cpp(31): error C2440: 'initializing' : cannot convert from 'void *' to 'const btCollisionObject *'
1>          Conversion from 'void*' to pointer to non-'void' requires an explicit cast
1>..\source\vdrift\collision_world.cpp(82): error C2440: 'initializing' : cannot convert from 'void *' to 'const btCollisionObject *'
1>          Conversion from 'void*' to pointer to non-'void' requires an explicit cast
1>..\source\vdrift\collision_world.cpp(83): error C2440: 'initializing' : cannot convert from 'void *' to 'const btCollisionObject *'
1>          Conversion from 'void*' to pointer to non-'void' requires an explicit cast
1>..\source\vdrift\collision_world.cpp(420): error C2440: '=' : cannot convert from 'const btCollisionObject *' to 'btCollisionObject *'
1>          Conversion loses qualifiers


I need to know what I can do to fix this
jacksiroke
 
Posts: 1
Joined: 29 Mar 2020, 00:52

Re: Casting errors while building on Windows us

Postby CryHam » 07 Apr 2020, 11:21

Well, I didn't build SR on Windows in years, so I can't tell the exact solution.
Looking at it, I think the code might be somewhat wrong in regard of using const.
No idea why, I already got in Bullet sources (on Debian) right type returned, for getBody: const btCollisionObject* getBody0() const { return m_body0;}

Following what C2440 says, you could try with added casts there (in lines 30,31,82,83):
{l Code}: {l Select All Code}
   const btCollisionObject* bA = (const btCollisionObject*)contactManifold->getBody0();
   const btCollisionObject* bB = (const btCollisionObject*)contactManifold->getBody1();

If that doesn't work right away, you could add const in the line above:
{l Code}: {l Select All Code}
 const btPersistentManifold* contactManifold


Line 420 is really weird m_collisionObject is const in my Bullet sources.
So either force cast in line 420:
{l Code}: {l Select All Code}
   m_collisionObject = (btCollisionObject*)obj;

or drop const from line 383, and use:
{l Code}: {l Select All Code}
   btCollisionObject* obj = rayResult.m_collisionObject;

This is bad, I'm guessing you have something different in Bullet.
User avatar
CryHam
SR Moderator
 
Posts: 702
Joined: 25 Nov 2012, 08:40

Who is online

Users browsing this forum: No registered users and 1 guest

cron