E0002: PImage needs to be a pointer

Compiler Error

What it means

Just like PGraphics, a PImage holds onto a graphics-card resource (the loaded image's texture). Copying isn't allowed for the same reason.

How to fix it

Use PImage* instead of PImage.

Example

Before
PImage img; img = loadImage("photo.jpg"); image(img, 0, 0);
After
PImage* img; img = loadImage("photo.jpg"); image(img, 0, 0);

Notes

image() already accepts the pointer directly, so you only need -> when reading something off the image itself, like img->width.