# Cannot be resolved or is not a field error

**URL:** <https://discourse.processing.org/t/cannot-be-resolved-or-is-not-a-field-error/9001>\
**Category:** Beginners\
**Created:** [March 6, 2019, 8:33am UTC](https://discourse.processing.org/t/cannot-be-resolved-or-is-not-a-field-error/9001 "2019-03-06T08:33:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kennyd](https://avatars.discourse-cdn.com/v4/letter/k/d2c977/32.png) [@kennyd](https://discourse.processing.org/u/kennyd)\
**Post date:** [March 6, 2019, 8:33am UTC](https://discourse.processing.org/t/cannot-be-resolved-or-is-not-a-field-error/9001/1 "2019-03-06T08:33:42Z")

</div>

Good morning,

I’m fairly new to processing, and ran into some trouble with my code regarding an error “body cannot be resolved or is not a field”. Processing also tells me that the global variable body does not exist, despite it being in the second line of code.

```auto
BDIM flow;
Body body;
SaveData dat;
FloodPlot flood;
boolean recording= true;
float t=0; float n=(int)pow(2,7); float xLengths=n/10; float yLengths=0.4; float xStart=n/3; float yStart=n/2; float yDist; float zoom;     
void setup() {
  size(700, 700); // display window size
  int resolution=(int)pow(2,7); // number of grid points                           
  Window window = new Window(resolution, resolution);
  body = new EllipseBody(n/3,n/2,n/10,0.4,window); // define geom
  flow = new BDIM(resolution, resolution, 1.5, body); // solve for flow using BDIM
  dat = new SaveData("saved/pressForce.txt", flow.body.pressForce(flow.p),n,xLengths,yLengths,zoom);
  flood = new FloodPlot(window); // initialize a flood plot...
  flood.setLegend("pressure", -1,1); // and its legend
}
void draw() {
  float D=(n/10)/0.4;
  t += flow.dt/D;
  body.follow(); // update the body
  flow.update(body); 
  flow.update2(); // 2-step fluid update
  flow.p.display(-0.5, 0.5); // display pressure
  dat.addData(flow.t, flow.body.pressForce(flow.p), flow.p); // add the pressure to the data file
    saveFrame("saved/frame-####.png"); // save images.
  flood.display(flow.p); // compute and display pressure
  body.display(); // display the body
  flood.displayTime(t);
    exit();
}

```

I have tried some other methods such as replacing

`dat = new SaveData(“saved/pressForce.txt”, flow.body.pressForce(flow.p),n,xLengths,yLengths,zoom);`

with

`dat = new SaveData(“saved/pressForce.txt”, flow.BDIM.pressForce(flow.p),n,xLengths,yLengths,zoom);`

which worked in the past when I was not trying to save the data but no longer works since updating processing to 3.5.3.

I would appreciate any advice or help, and apologize if this is a really simple question.

Thank you for your time

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [March 8, 2019, 11:39pm UTC](https://discourse.processing.org/t/cannot-be-resolved-or-is-not-a-field-error/9001/2 "2019-03-08T23:39:56Z")

</div>

Please format your code with `</>` button, not `"`.

You code begins:

```
Body body;

```

That means that the compiler will look, in your code on that tab, or another tab, or in an included library, for a definition of what the class “Body” is – something like:

```auto
class Body {
  int foo;
  Body (int foo){
    this.foo = foo;
  }
}

```

Based on the fact that later in the code you try to create a Body by initializing an EllipsseBody object, It looks like you are using a library of some kind? And the include statement for that library is missing?
