I took two day,but I still can not fix the problem.
Thanks for your help.
I am using the newest box2d template(version 0.8.2 ).
When I run the app,it works fine but get 10 warnings:
warnings:statement has no effect
And when I added MyContactListener,I get more warnings,and nothing happen.
I try to printf "Hello World ".
I add this to HelloWorldScene.m:
mContactListener = new MyContactListener;
world->SetContactListener(mContactListener);
This is MyContactListener class
#include "Box2D.h"
class MyContactListener : public b2ContactListener
{
public:
//Methods override from b2ContactListener
void Add(const b2ContactPoint* point) ;
void Persist(const b2ContactPoint* point);
void Remove(const b2ContactPoint* point);
//clear contact point vector
void Clear();
};
void MyContactListener::Add(const b2ContactPoint* point){
printf("Hello world.")
}
void MyContactListener::Persist(const b2ContactPoint* point){
}
void MyContactListener::Remove(const b2ContactPoint* point){
}