shiffman / Box2D-for-Processing

Processing JBox2D helper library and examples
BSD 2-Clause "Simplified" License
286 stars 75 forks source link

No Such Method - just getting started NOC Chapter 5 #11

Closed cranbim closed 9 years ago

cranbim commented 9 years ago

Having added the JBox2D and Box2D for Processing libraries for NOC chapter 5 I get compile error running the code examples. The libraries are recognised as I can declare my first Box2DProcessing object instance (which is a change from the PBox2D object convention in the book text). Having declared it and calling createWorld() on it I get a compile error. "you may be using a library that incompatible with this version of processing".

Below is the simplest version of code that fails to compile. Processing 2.2.1, and current release of Box2DProcessing library and JBox2D (2.2.1). Any help appreciated?

import shiffman.box2d.; import org.jbox2d.collision.shapes.; import org.jbox2d.common.; import org.jbox2d.dynamics.;

Box2DProcessing box2d;

void setup() { size(640, 360); box2d = new Box2DProcessing(this);
box2d.createWorld(); }

dimkir commented 9 years ago

Well I just tried your code and it worked for me.

import shiffman.box2d.*;
import org.jbox2d.collision.shapes.*;
import org.jbox2d.common.*;
import org.jbox2d.dynamics.*;

Box2DProcessing box2d;

void setup() {
size(640, 360);
box2d = new Box2DProcessing(this);

box2d.createWorld();
}

And I have processing 2.2.1 and also inside of libraries folder it seems that same version of JBox2D is installed as you mentioned. image

How did you install the JBox2D (or Box2D processing library) ? I have simply installed it via Sketch \ Import Library \ Add Library menu and it worked.

Also are you using Java which was packaged with the Processing?

cranbim commented 9 years ago

Thanks for exceptionally quick response. I am using Processing's Java and IDE, and I installed the libraries manually, but I think I that was the issue. I had added the JBox2D library myself (not realising it was included with Box2D for Processing) I just removed the JBox2D I had added and the examples compiled and ran. Interestingly, after putting it back again (just to check this was the decisive factor) I got a much more help "conflicting libraries" message from the compiler. Thanks again.

shiffman commented 9 years ago

Glad to hear this was resolved. If you think I should change / fix anything in the docs to make this more clear please let me know!