has not been declared

Hello,
I have the following error:
BatteryBox.h:72:13: error: 'MyToolBox' has not been declared
void begin(MyToolBox _toolBox);

Here is the MyToolBox header class:
#ifndef MyToolBox_h
#define MyToolBox_h

#include <Arduino.h>
#include <BatteryBox.h>

#define DELAY 4000

class MyToolBox {

public:

MyToolBox(char _version);

MyToolBox(){};

void begin(Print &print);
....
}

Here is the BatteryBox header file:
class BatteryBox
{
public:

BatteryBox(){};

BatteryBox(char _version);

void begin(MyToolBox _toolBox);

void initHardware();

boolean eepromInit(config_t *configuration, Print &print);

void printCalibrationValues(config_t configuration);

//private:
MyToolBox toolBox;
char version;
};

And the arduino code:

MyToolBox toolBox(1);
BatteryBox batteryBox(1); // ne supporte pas un constucteur sans paramètres !

void setup() {
Serial.begin(115200);
while (!Serial); // Arduuino micro !
toolBox.begin(Serial);
batteryBox.begin(toolBox);
batteryBox.initHardware();
...
}

The source files are in attachments.

Any help will be welcome and I will be very happy to understand my error.
Best regards to every readers !

Thierry

BatteryBox.cpp (5.54 KB)

BatteryBox.h (1.91 KB)

MyToolBox.cpp (1.69 KB)

MyToolBox.h (539 Bytes)

I can't see MyToolBox.h being #included in your program. Might that be a problem ?

In future please use code tags when posting programs as it makes them so much easier to read. You will, of course, have read Read this before posting a programming question ... - Programming Questions - Arduino Forum

Hello,
Thanks for reading my post.
In the first part are MyToolBox.h.
I put it in attachement too, and Arduino code.

Thanks and bast regards.
Thierry

MyToolBox.h (539 Bytes)

Test_And_Calibration.ino (10.6 KB)

Vorms:
Hello,
Thanks for reading my post.
In the first part are MyToolBox.h.
I put it in attachement too, and Arduino code.

Thanks and bast regards.
Thierry

I see references to MyToolBox.h in this thread but I do not see it #included in your program.

Hello,
In the Arduino code, the #include for MyToolbox is in line 22.

Many thanks for your help.

Thierry

In the Arduino code, the #include for MyToolbox is in line 22.

You have not shown the complete Arduino code. Don't expect more than guesses without doing that.

Hello,
See in attachement the complete Arduino code.

Many thanks for your help !

Best regards

Thierry

Test_And_Calibration.ino (10.6 KB)

	void MyToolBox::begin(Print &print){
		printer = &print; //operate on the address of print	  
		
	}

The begin() method should be defined to take a pointer, not a reference. It should be up to the user to pass it the right thing.

I was going to try to compile your code, but it uses way too many libraries that I don't have. You need to create a simple sketch that illustrates the problem. Clearly, the problem has nothing to do with servos, thermometers, LCD shields, etc. So get rid of that stuff.

Hello,
You are right, I removed all not relevant code for Arduino.

See in attachment the small code.

And a small header used to write in the EEprom section.

I will modify the call with the Print...

Many thanks,
Thierry

debug.ino (538 Bytes)

EEPROMAnything.h (535 Bytes)

The MyToolBox class does not need to know anything about the BatteryBox class. So, get rid of the #include statements for BatteryBox.h in both the source and header files for MyToolBox.

I put the MyToolBox header and source files in a folder called ToolAndBatteryBox in my Arduino\libraries folder. I changed BatteryBox.h to use quotes around the file name, rather than angle brackets, when including MyToolBox.h.

I used quotes in the sketch, too, for both files. When I compile, now, I get:

Binary sketch size: 1,882 bytes (of a 30,720 byte maximum)