Error with b2EdgeShape [resolved]

General Box2D issues or C++ specific issues
nigelk
Posts: 4
Joined: Sun Apr 26, 2015 1:25 am

Error with b2EdgeShape [resolved]

Postby nigelk » Sun Apr 26, 2015 5:00 am

Hi, I'm working on a Tile based 2d platformer and creating the walls as b2EdgeShapes using this tutorial on ghost vertices because of the box2d bug when the player get stuck on vertices when you use one box for each tile.

I have this error message when i'm trying to use b2EdgeShape

Code: Select all

undefined reference to `b2EdgeShape::Set(b2Vec2 const&, b2Vec2 const&)'|

I don't use TestBed so I can't reproduce it, but I can show you the essential :

Code: Select all

#include <Box2D/Box2D.h>
void myFunctionForWallCreation()
{
   b2EdgeShape *tabEdgeShape [nbOfWalls];
   b2Vec2 tableau[2];
   // set of tableau's values here depending of the vertices position of my walls
   // and then this loop
   while (i<nbOfWalls)
   {
      // so here is the problem :
      tabEdgeShape[i]->Set(tableau[0],tableau[1]); // this line fail
      i++;
   }
}


I searched a lot on google and in this forum but i didn't find, I use many box2d features but only this one fail.
I tried with all version of box2d that i've found (v2.2.0, v2.1.2, v2.3.0) that allow using b2EdgeShape.

I really need your help, I can't figure out how to fix it and i'm pretty sure that i'll not find it by myself now..
Thank you in advance and sorry if my english is bad :mrgreen:
ps : I have windows 8 and I use CodeBlocks in C++.
Nigel
Last edited by nigelk on Mon Apr 27, 2015 3:29 pm, edited 1 time in total.

nigelk
Posts: 4
Joined: Sun Apr 26, 2015 1:25 am

Re: Error with b2EdgeShape

Postby nigelk » Mon Apr 27, 2015 4:27 am

Ok so I think that there's a bigger problem, I'm including box2d like this :

Code: Select all

#include <Box2D/Box2D.h>

my Box2d folder is in
C:\Program Files (x86)\CodeBlocks\MinGW\include

I hope that's this is enough to use Box2D, i'm already using polygonShape for my character and it works perfectly.
So the problem is bigger cause if I add a b2ChainShape, I've got these errors:

Code: Select all

undefined reference to `b2ChainShape::~b2ChainShape()'|
undefined reference to `vtable for b2ChainShape'|

undefined reference to `b2EdgeShape::Set(b2Vec2 const&, b2Vec2 const&)'|
undefined reference to `vtable for b2EdgeShape'|


I've searched in google what was meaning the error

Code: Select all

undefined reference to 'vtable fo b2EdgeShape'
, vtable seems to be something related to virtual function inherited and non-redefined in the child class.. (tell me if I'm wrong)
I don't really understand why this is happening here.. Really if you have any information about this, please tell me..
I'm totally blocked in the development of my game, I can't use b2ChainShape and b2EdgeChain so I can't resolve the problem of the character getting stuck by vertice of the ground and walls.
ps : I can use CircleShape too so I think that this problem might be related to the upgrade of v2.2.
EDIT: I think that i didn't set Box2D like it should be, i'll try to fix this...

Nigel

nigelk
Posts: 4
Joined: Sun Apr 26, 2015 1:25 am

Re: Error with b2EdgeShape

Postby nigelk » Mon Apr 27, 2015 3:27 pm

It was my bad, I didn't know how to install properly a library, I've fixed this and it works perfectly :) I used this french tutorial very complete, maybe it can help some library's noobs like me :P
Nigel


Return to “Bugs, Requests, and Feedback”



Who is online

Users browsing this forum: No registered users and 1 guest