Problem using objects in functions

You have to create this variable in some scope somehow. You probably want to create this is a global variable, as opposed to a local function variable. I see you already have

So in here should be some content like

#ifndef _GLOBAL_VARS_H
#define _GLOBAL_VARS_H

#include "Pumps.h"
//declare existence of wateringPump variable to the world
extern Pumps wateringPump;

#endif

And then in some .cpp file, say e.g. src\globalVars.cpp, or src\main.cpp, …

#include "Pumps.h"
#include "globalVars.h"

// example pin
#define WATERPUMP_PIN 10
// **define** global variable here
Pumps wateringPump(WATERPUMP_PIN);

Note the difference of declaration and definition in C++. See the resources linked in Divide code into several files.

Then any cpp file that does #include "globalVars.h" will have access to the globally shared wateringPump object.